1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/script/random-sleep.sh
Stefan Metzmacher ab96359bfe 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
2012-06-20 14:56:51 +02:00

22 lines
287 B
Bash
Executable File

#!/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"