43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
numcpu=2
fi
# NB// max_load is in units of percent.
#
lperc=$(echo "100 * $load / $numcpu"|bc)
lperc2=$(echo "100 * $load2 / $numcpu"|bc)
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 &> /dev/null
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: \"$@\""
launchjob "$@"
# 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
|
>
|
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
numcpu=2
fi
# NB// max_load is in units of percent.
#
lperc=$(echo "100 * $load / $numcpu"|bc)
lperc2=$(echo "100 * $load2 / $numcpu"|bc)
let "lperc2adj=$lperc2 + $numcpu"
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 &> /dev/null
if [[ $lperc -lt $max_load ]];then
if [[ $lperc -le $lperc2adj ]];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: \"$@\""
launchjob "$@"
# 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
|