1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
-
-
+
+
+
+
+
+
+
+
-
+
+
-
+
|
#!/bin/bash -e
#!/bin/bash -ex
load=`uptime|awk '{print $10}'|cut -d, -f1`
numcpu=`cpucheck|tail -1|awk '{print $6}'`
# load=`uptime|awk '{print $10}'|cut -d, -f1`
load=`uptime|perl -pe 's/.*: (\d+.\d+),.*/$1/'`
if which cpucheck > /dev/null;then
numcpu=`cpucheck|tail -1|awk '{print $6}'`
else
numcpu=`lscpu|grep "CPU.s.:"|awk '{print $2}'`
fi
lperc=`echo "100 * $load / $numcpu"|bc`
if [[ $lperc -lt 100 ]];then
# echo "Load percent: $lperc < 100, using nbfake"
nbfake $(*)
nbfake "$@"
# $(*)
else
# echo "Load percent: $lperc > 100, using NBLAUNCHER"
$NBLAUNCHER $(*)
$NBLAUNCHER "$@"
fi
|