aboutsummaryrefslogtreecommitdiff
path: root/plugins/wait_random
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/wait_random')
-rwxr-xr-xplugins/wait_random13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/wait_random b/plugins/wait_random
new file mode 100755
index 0000000..2980ac6
--- /dev/null
+++ b/plugins/wait_random
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Wait a random amount of seconds between 0 and $1.
+# Used for SSH connections to not DOS servers.
+#
+# USAGE: wait_random MAX_TIME COMMAND ARGS ...
+
+MAXTIME="$1"
+shift
+
+sleep $((RANDOM % MAXTIME))
+
+exec "$@"