#!/bin/sh ##########
# bootmail
# 
# Send mail to SysAdmins upon reboot so that they are aware that:
# - someone else rebooted the machine
# - the machine crashed
# etc.
# 27-Jan-1999 Garry J. Garrett, (Sean Boran added a few notes on 5.Jan.01)
# Sean installs it in /secure and links in the startup files:
#   ln -s /secure/bootmail /etc/init.d/bootmail
#   ln -s /secure/bootmail /etc/rc3.d/S99bootmail
#   ln -s /secure/bootmail /etc/rc3.d/K00bootmail

case "$1" in

'start' | 'boot' | 'reboot') /bin/echo "`/bin/uname -n` rebooted `date`" \ |
/bin/mailx -s "`/bin/uname -n` rebooted" root ;;

'stop' | 'shutdown' | 'down') /bin/echo "`/bin/uname -n` going down `date`"
\ | /bin/mailx -s "`/bin/uname -n` going down" root ;;

*) /bin/echo "Usage: /etc/init.d/bootmail { start | stop }" ;; 

esac

