Computing.Net > Forums > Unix > Script to send email if Unix reboot

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script to send email if Unix reboot

Reply to Message Icon

Name: stanley
Date: February 7, 2003 at 00:10:55 Pacific
OS: Solaris 7
CPU/Ram: 250 enterprise server
Comment:

I need a script to send an e-mail to system admin when a Solaris 7 server reboot.

Please send me a example script if anyone has the script available.

Thank you for help



Sponsored Link
Ads by Google

Response Number 1
Name: Jimbo
Date: February 7, 2003 at 02:47:13 Pacific
Reply:

Stan,

just put a script in /etc/rc2.d called K99reboot_notify . The contents could be something like:

#! /bin/sh
echo "Server `uname -n` going down for reboot at `date`" > /tmp/message.$$

cat /tmp/message.$$ | mailx -s "`uname -n` reboot notice" you@mail.com


To get notice on startup, put a script in /etc/rc3.d called S99reboot_notice:


#! /bin/sh
echo "Server `uname -n` completing startup on `date`" > /tmp/message.$$

cat /tmp/message.$$ | mailx -s "`uname -n` startup notice" you@mail.com

rm /tmp/message.$$

This is untested, but should work.

-jim


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Script to send email if Unix reboot

script to send email if su executed www.computing.net/answers/unix/script-to-send-email-if-su-executed/5525.html

script to send email/shutdown www.computing.net/answers/unix/script-to-send-emailshutdown/3409.html

How to send mail on UNIX to smtp mail www.computing.net/answers/unix/how-to-send-mail-on-unix-to-smtp-mail/2394.html