mailing from a script
Eric Rossiter
rossiter at discoverynet.com
Tue Jun 19 19:39:01 CDT 2001
Hi LU's
I have a script which monitors the machines on the network to see if they
are up (ping).
I have in this script the following:
while :
do
...
done
to facilitate this script running all the time, without quitting. As it now
stands, I have to stop this script and then kill the process. Is there a
"nicer" way to set this loop to run forever or at least a very long time?
Also, I test the exit status of ping ($?) to tell if the machine is up or
down. If the machine is down I am using logger to write to
/var/log/messages, but how would I send an email to "admin" on the box this
script is running on...or....an external email to a good email address. I
know from past experience that I can enter MAILTO=rossiter at discoverynet.com
in crontab -e and it mails me if the backup script fired from cron errs or
dies, but I can't figure out how to mail myself either locally or through
outside email from this script I am working on.
I've read man mail about ten times and am quite lost.
TIA,
Eric
More information about the Kclug
mailing list