22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
if [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
max_load=100
else
max_load=$MAX_ALLOWED_LOAD
fi
lfile=/tmp/loadrunner-$USER.lockfile
lockfile -r 2 -l 20 $lfile
if [[ $lperc -lt $max_load ]];then
if [[ $lperc -le $lperc2 ]];then
echo "Load acceptable: lperc=$lperc %, max_load=$max_load %, load=$load, numcpu=$numcpu, MAX_ALLOWED_LOAD=$MAX_ALLOWED_LOAD % and $lperc2 < $lperc"
echo "Starting command: \"$@\""
nbfake "$@"
# we sleep ten seconds here to keep the lock and give time for
# the uptime to show a response
sleep 10
else
rm -f $lfile
echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
fi
else
# echo "Load too high: lperc=$lperc, max_load=$max_load, waiting two minutes before trying to run command: \"$@\""
echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
fi
|
|
|
<
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
if [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
max_load=100
else
max_load=$MAX_ALLOWED_LOAD
fi
lfile=/tmp/loadrunner-$USER.lockfile
lockfile -r 5 -l 60 $lfile
if [[ $lperc -lt $max_load ]];then
if [[ $lperc -le $lperc2 ]];then
echo "Load acceptable: lperc=$lperc %, max_load=$max_load %, load=$load, numcpu=$numcpu, MAX_ALLOWED_LOAD=$MAX_ALLOWED_LOAD % and $lperc2 < $lperc"
echo "Starting command: \"$@\""
nbfake "$@"
# we sleep ten seconds here to keep the lock a little longer and give time for
# the uptime to show a response
sleep 10
else
echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
fi
else
# echo "Load too high: lperc=$lperc, max_load=$max_load, waiting two minutes before trying to run command: \"$@\""
echo "$LOADRUNNER $@" | at now + 2 minutes 2> /dev/null
fi
|