O.K. Now that you know your email out is working
open an editor (Midnight
Commander, Webmin File Manager, or if all else fails VI) and edit /etc/rc.d/rc.local *see note at bottom
This file is like the “startup folder” in
Windows; all the commands in it are run after all other init scripts and
it’s an easy place to do your custom add-ons. Put your “mail” command in
there so that every time the system boots it emails notice of that event to
you.
Add one line for each email address you would
like to receive a notification, of course you can send to group email addresses
like any other email. Because I have a pretty good population of systems
out there I like to specify which one is sending in the subject line (–s)
and have it drop the specific server host name in the message body, i.e.
hostname | mail -s "Customer-Name"
support@mydomain.com
Of course, you can pipe just about any command
line info to the mail command and have it appear as the message body i.e.
df -h | mail -s “Customer disk space report”
support@mydomain.com
would deliver a report on the systems disk space
as the message body.
There, you’re all set to get notified when
servers boot up, read on to learn how to get email notifications when
safe_asterisk reload the service ~without~ the system rebooting.
.
|