Artifact 03c58ee4f1a9a33d930ffe023d322a9911ee7db6:
- Executable file utils/nbfind — part of check-in [a684b5f022] at 2012-03-26 21:05:47 on branch trunk — Added ability to override max load in nbfind, default is 50% of avail. cpus (user: matt, size: 462) [annotate] [blame] [check-ins using] [more...]
#!/bin/bash
# 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 [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
max_load=50
else
max_load=$MAX_ALLOWED_LOAD
fi
if [[ $lperc -lt $max_load ]];then
nbfake "$@"
else
$NBLAUNCHER "$@"
fi