[in reply to [EMAIL PROTECTED], 14-1-2005]

> I would like one of my servers to send me an email when
> it boots. I envision a script in rc.conf to do this.
>
> Is there an easier way, or an automatic system which can do this?


        We  are  using  a  simple  shell  script that can be placed in
        /usr/local/etc/rc.d/bootreport.sh.  It  sends  out an email to
        root  with  the dmesg output, and also sends an email when the
        system is being shut down.
        

#!/bin/sh

HOSTNAME=`/bin/hostname`;

case "$1" in
        start)
                (echo $HOSTNAME was booted at `/bin/date` ; echo ''; echo '--'; 
echo ''; echo 'dmesg output:' ; /sbin/dmesg) | mail -s "$HOSTNAME boot" root
                ;;
        stop)
                echo $HOSTNAME was shut down on user request at `/bin/date` | 
mail -s "$HOSTNAME shutdown" root
                ;;
        *)
                echo ""
                echo "Usage: `basename $0` { start | stop }"
                echo ""
                exit 64
                ;;
esac
        


-- 
 Walter Hop <[EMAIL PROTECTED]> | TransIP | http://www.transip.nl/

_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to