Soooo, the script that i found in my '/usr/sbin' directory differs from the script on github...
and i'm on the latest version of OMV (4.1.22-1 (Arrakis) )
in detail the function in my script gets the value for the load as follows:
Code: autoshutdown.sh
CURRENT_LOADAVERAGE_TEMP1="$(top -b -n 1 | grep 'load average')"
# old: not working, if uptime is more than 1 day
#CURRENT_LOADAVERAGE_TEMP2="$(echo $CURRENT_LOADAVERAGE_TEMP1 | awk '{print $11}' | sed 's/,//g')"
# produces a nil value. Removed the last pipe to sed as temporary fix
#CURRENT_LOADAVERAGE_TEMP2="$(echo $CURRENT_LOADAVERAGE_TEMP1 | sed 's/.*load average: //g' |awk '{print $1}' | sed 's/,//g' | sed 's/.//g;s/\.//g')"
CURRENT_LOADAVERAGE_TEMP2="$(echo $CURRENT_LOADAVERAGE_TEMP1 | sed 's/.*load average: //g' |awk '{print $1}' | sed 's/,//g')"
if [ "$CURRENT_LOADAVERAGE_TEMP2" = "0.00" ]; then
CURRENT_LOADAVERAGE=0
else
CURRENT_LOADAVERAGE=$(echo $CURRENT_LOADAVERAGE_TEMP2 | sed 's/[,.]//g' | sed 's/^0*//g')
fi
Alles anzeigen
...i already tried to "quick-and-dirty" fix it by commenting out line 436 and skipping the last stream editing pipe (as for me, that produces a nil value). I have no clue what i did there, and i don't really understand what the autor tries to edit (and why) there, but for now that works for me. I'll give it another look if i have more time (and feel like i want to understand it )
EDIT: to clearify, thats what i edited in line 435 to 437 (in the original file there was only line 436 without the #)