Date: Fri, 14 Jan 2005 22:57:22 +0100 From: Walter Hop <freebsd@walter.transip.nl> To: Jim Pazarena <fquest@ccstores.com> Cc: FreeBSD Questions <questions@freebsd.org> Subject: Re: boot up notification Message-ID: <202114071.20050114225722@lifeforms.nl> In-Reply-To: <41E833FB.5070306@ccstores.com> References: <41E833FB.5070306@ccstores.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[in reply to fquest@ccstores.com, 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 <freebsd@walter.transip.nl> | TransIP | http://www.transip.nl/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202114071.20050114225722>
