User Tools

Site Tools


linux:systemload-script

System Load script

#!/bin/bash
 
# get load from /proc as it's easier to parse then w or top etc.
 
LOAD=$(cat /proc/loadavg)
 
onemin=$(echo $LOAD | cut -d ' ' -f 1)
fivemins=$(echo $LOAD | cut -d ' ' -f 2)
fifteenmins=$(echo $LOAD | cut -d ' ' -f 3)
restofline=$(echo $LOAD | cut -d ' ' -f 4-)
 
printf "1 min\t 5 mins\t 15 mins\n"
printf "${onemin}\t ${fivemins}\t ${fifteenmins}\n\n"
 
printf "Rest of line %s\n" "${restofline}"
linux/systemload-script.txt · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki