[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cronjobs and top not getting along
I have a basic script running on my server that check for cpu utilization.
If the number is over 70%, then it issues a page to let me know.
The line in the script I use to gather the number for the cpu utilization
is as follows:
top | head -3 | tail -1 | cut -d " " -f 7 | cut -d % -f 1 > filename
To test the script, I had the server page me with the current processor
utilization:
set usage = `cat filename`
echo "The server is running at $usage percent" | page charles 123-4567 -
From the command line, everything works well, and I get a page
saying the server is running at 2 percent. However, when this is ran as a
cronjob, i receive the page and the variable is not included. Sure enough,
when I cat filename, its empty. The server issues an email letting me know
the error it encounters. I receive:
top: ioctl() failed: Not a typewriter
Is there a way around this. Frankly I am not certain what this error
means, but I am sure that it has something to do with the fact that top
refreshes itself. Top doesnt have a flag to disable the refresh, but there
is one that allows the interval to be set. I am going to try to set the
interval to a somewhat long length and see what happens.
Any suggestions?
thanks!
Charles
--
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.