- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sending mail automatically at system shutdown and ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2004 06:36 PM
02-27-2004 06:36 PM
Sending mail automatically at system shutdown and after reboot
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2004 09:20 PM
02-27-2004 09:20 PM
Re: Sending mail automatically at system shutdown and after reboot
I think, uptime will be enough for sending email notification.
Just an idea:
Use uptime to check the system uptime. If it is less than 30 minutes send an alert.
Hope this helps
vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2004 05:04 PM
02-28-2004 05:04 PM
Re: Sending mail automatically at system shutdown and after reboot
Use the run control file to send you an email. You may add a line to send email notice in the end of /sbin/rc3 file, so that you will receive a mail once the system is rebooted and online.
This idea is better than the previos one.
Hope this helps
Vijay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2004 05:15 PM
02-28-2004 05:15 PM
Re: Sending mail automatically at system shutdown and after reboot
You can write one script that will take care of sending mail for both shutdown and after reboot. However, if the system crashes due to any error the shutdown script won't send any mail.
Look at /sbin/init.d/template file on how to write the code. Basicall there should be a case statement with four cases. start - code to run when the system is booting, stop - code to run when the system is going down, start_msg - Message to be displayed at the console when the system is coming up and stop_msg - Message to be displayed when the system is going down. Your script for each of these cases would be simple. Just send a mail with appropriate subject and body.
Once the /sbin/init.d/your_script is created, I would put the links in /sbin/rc3.d and create them like S800myscript and K800myscript. I prefer rc3.d as the mail client you use would invoke sendmail as a client and sendmail won't work nicely if the system is not with appropriate network configuration.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2004 05:54 PM
02-29-2004 05:54 PM
Re: Sending mail automatically at system shutdown and after reboot
date | mailx -s "Shutdown the system" someone@somwhere.com
When system is up:
date | mailx -s "System up again" someone@somwhere.com
Thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2004 06:11 PM
02-29-2004 06:11 PM
Re: Sending mail automatically at system shutdown and after reboot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2004 01:23 AM
03-01-2004 01:23 AM
Re: Sending mail automatically at system shutdown and after reboot
Create a script in /sbin/init.d
#!/sbin/sh
unset UNIX95
PATH=/sbin:/usr/sbin:/usr/bin:/usr/lib/netsvc:/usr/lib/netsvc/yp
export PATH
rval=0
set_return () {
x=$?
if [ $x -ne 0 ] ; then
echo "FAILURE CODE: $x"
rval=1
fi
}
case $1 in
start_msg)
echo "Mail server boot status"
;;
stop_msg)
echo "mail server shutdown status"
;;
start)
DATE=`/usr/bin/date`
/usr/bin/mailx -s "Server booted at $DATE" yourid@yourdomain.com ;;
stop)
DATE=`/usr/bin/date`
/usr/bin/mailx -s "Server Shutdown at $DATE" yourid@yourdomain.com ;;
esac
exit 0
Then in /sbin/rc3.d link it:
ln -s ../init.d/servermsg S995servermsg
Then in rc2.d link it:
ln -s ../init.d/servermsg K001servermsg
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2004 11:27 AM
03-01-2004 11:27 AM
Re: Sending mail automatically at system shutdown and after reboot
Best of luck.
Regards,
dl