one simple shell CGI script
Recently I want to learn further the shell programming. So just make the script to get the CPU usage rate.
#!/bin/bash
INPUT=/proc/stat
INTERVAL=1;
GetLoad(){
T2=`sed -n “1″p $INPUT |awk ‘{ print $2+$3+$4+$5+$6+$7+$8 }’`;
A2=`sed -n “1″p $INPUT |awk ‘{print $5}’`
}
GetLoad;
A1=$A2
T1=$T2
sleep… Continue reading