aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-11-19 12:47:20 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-11-19 12:47:20 +0100
commit1e58d00c444c8eb2a03c557f6c4aa65d1718360d (patch)
tree6ecab9ccddaeb5d1a324b4bc86b34d015d3e0d27
parentd6dc8b2af0b8110e1fc5c01375a8c1a3466cd3f5 (diff)
downloadmonitoring_custom-1e58d00c444c8eb2a03c557f6c4aa65d1718360d.tar.gz
add 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 "$@"