mailing from a script

Duston, Hal hdusto01 at sprintspectrum.com
Tue Jun 19 19:48:23 CDT 2001


Tuesday, June 19, 2001 2:42 PM, "Eric Rossiter"
<rossiter at discoverynet.com> wrote:

--snip--
> 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

mail -s "Status of `uname -a`" rossiter at discoverynet.com admin at localhost <<!
`uname -a` is unreachable
!

Or something vaguely resembling that.

Hal Duston




More information about the Kclug mailing list