diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-06-20 11:03:48 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-20 14:56:51 +0200 |
commit | ab96359bfefa08eddfb688137ca07c1efcbb494f (patch) | |
tree | 8ab436ccfe073459a2b0114256babf9b270d4b64 /script/random-sleep.sh | |
parent | c30e6b5973b78c04b9131a2adf1eb5dda2222c2f (diff) | |
download | samba-ab96359bfefa08eddfb688137ca07c1efcbb494f.tar.gz samba-ab96359bfefa08eddfb688137ca07c1efcbb494f.tar.bz2 samba-ab96359bfefa08eddfb688137ca07c1efcbb494f.zip |
script/autobuild: delay start of small projects by 60 to 600 seconds
This should reduce the startup load.
metze
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jun 20 14:56:51 CEST 2012 on sn-devel-104
Diffstat (limited to 'script/random-sleep.sh')
-rwxr-xr-x | script/random-sleep.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/script/random-sleep.sh b/script/random-sleep.sh new file mode 100755 index 0000000000..70b0c03ec9 --- /dev/null +++ b/script/random-sleep.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# + +if [ $# -lt 2 ]; then + echo "$0: <low> <high>" + exit 1; +fi + +l=$1 +h=$2 + +s=$(expr $h - $l) + +r=$(head --bytes=2 /dev/urandom | od -l | head -n 1 | sed -e 's/^[^ ]* *//') + +v=$(expr $r % $s) +d=$(expr $l + $v) + +echo "$0: sleep $d ... start" +#sleep $d +echo "$0: sleep $d ... end" |