sar -u 1 | awk '{print $9}'
so this will give me "CPU Idle" value every second. I'd like to get email in this case the value goes to "0" 10 times in a row?
What would be the appropriate way to do it?
I found a preliminary solution
sar -u 1 | awk '{ if (int($9)==0) {
i=i+1; {
print i, $9
}
}
if (int($9)>=0) {
i=0
}
if (i>=10) print "sending email"
}'
but in last line where I print "sending email" I can't put call to mutt, like this
sar -u 1 | awk '{ if (int($9)==0) {
i=i+1; {
print i, $9
}
}
if (int($9)>=0) {
i=0
}
if (i>=10) mutt -s "VPNC Problem" test@test.com < /home/semenov/strace.output
}'
the problem is that it says "syntax" error in mutt command call. Any ideas?