[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Re: Have CPU info sent via mail



> I'm looking for at way of having these output sent via mail from a
> cronjob containing this:
> cat /proc/cpuinfo | grep temperature
> cat /proc/meminfo
> cat /proc/loadavg

First do 'crontab -e' to being editing the crontab file for your user. 

The grep for temperature throws off the 'elegancy' factor of

cat /proc/cpuinfo /proc/meminfo /proc/loadavg | \
 mail -s "CPU stats" you@xxxxxxxxxxx

If you want just temp from procinfo and have stats from all 3 commands in 
just one email, you'd have to dump the output of each command to a holding 
file first, and then mail the contents of that file:

2 * * * * cat /proc/cpuinfo | grep temperature > /tmp/cpustats; cat 
/proc/meminfo /proc/loadavg >> /tmp/cpustats; cat /tmp/cpustats | mail -s 
"CPU Stats" you@xxxxxxxxxxx; rm /tmp/cpustats

(above would be all one line; 2 * * * * = send at x:02 hourly)