Using cron and atactl to email smartstatus errors
to an email address other than cron user:
-----------------------------------------


I was playing with the suggesion in the man
page for atactl and smart status. After using rc.local
to make sure smart is enabled, something like
 echo -n 'wd0: '
 /sbin/atactl wd0 smartenable
 /sbin/atactl wd0 smartstatus

Now to put someting in crontab to hourly check for errors,
per suggestion of man page for atactl I could use:
0 * * * * /sbin/atactl /dev/wd0c smartstatus >/dev/null

And the error will email to root, or if the variable
[EMAIL PROTECTED]
Then all error messages from cron will go there :(

I can see where I might want some tasks to email
standard error messages to other than the cron user or MAILTO,
like sending an email to a pager or other alert email box.
Thus the question, how to edit cron task to send normal output to null
but email error messages...  Handling outputs if I rember
and a quick google found a page that seems to confirm,
http://ibmdocs.ncep.noaa.gov/userman/cron.html
suggests 1> should be standard and 2> should be errors
so we should be able to do something like

0 * * * * /sbin/atactl /dev/wd0c smartstatus 1>/dev/null 2>mail -s "wd0 ERRORS on serverXYZ" [EMAIL PROTECTED]


Other than using up your pager allotment, does anyone see
a problem doing it this way, please correct.


If a server is not raid, and using cheaper ide/sata drives,
this might be a useful way to be urgently notifed of
a hard drive that may fail.

- cheers

Reply via email to