utils: add net notify
[Samba.git] / script / random-sleep.sh
blob6d79ffbf2998089cfb7188cbef493bb78fc0c62f
1 #!/bin/sh
4 if [ $# -lt 2 ]; then
5 echo "$0: <low> <high>"
6 exit 1;
7 fi
9 l=$1
10 h=$2
12 s=$(expr $h - $l)
14 r=$(head --bytes=2 /dev/urandom | od -l | head -n 1 | sed -e 's/^[^ ]* *//')
16 v=$(expr $r % $s)
17 d=$(expr $l + $v)
19 if test "x${AUTOBUILD_RANDOM_SLEEP_OVERRIDE}" != "x" ; then
20 d="${AUTOBUILD_RANDOM_SLEEP_OVERRIDE}"
23 echo "$0: sleep $d ... start"
24 sleep $d
25 echo "$0: sleep $d ... end"