23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
if [[ $TARGETHOST == "" ]]; then
sh -c "cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* > $TARGETHOST_LOGF 2>&1 &"
else
ssh -n -f $TARGETHOST "sh -c \"cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* > $TARGETHOST_LOGF 2>&1 &\""
fi
}
if which cpucheck > /dev/null;then
numcpu=`cpucheck|tail -1|awk '{print $6}'`
elif which lscpu > /dev/null;then
numcpu=`lscpu|grep "CPU.s.:"|awk '{print $2}'`
else
numcpu=2
|
>
>
>
>
>
>
>
|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
if [[ $TARGETHOST == "" ]]; then
sh -c "cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* > $TARGETHOST_LOGF 2>&1 &"
else
ssh -n -f $TARGETHOST "sh -c \"cd $CURRWD;export DISPLAY=$DISPLAY; export PATH=$PATH; nohup $* > $TARGETHOST_LOGF 2>&1 &\""
fi
}
function get_delay_time () {
RANGE=$1
number=$RANDOM
let "number %= $RANGE"
echo $number
}
if which cpucheck > /dev/null;then
numcpu=`cpucheck|tail -1|awk '{print $6}'`
elif which lscpu > /dev/null;then
numcpu=`lscpu|grep "CPU.s.:"|awk '{print $2}'`
else
numcpu=2
|
61
62
63
64
65
66
67
68
69
|
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
sleep 4
rm -f $lfile
|
|
|
68
69
70
71
72
73
74
75
76
|
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
sleep $(get_delay_time 10)
rm -f $lfile
|