Hi,
I would rather suggest you put the code into
/etc/conf.d/local.stop
That script is executed before anything in /etc/init.d is stopped.
If you want to make sure the mail has left your system, you might
test if the outgoing mail directory is empty. In my case that is
/var/spool/postfix/active
One way to wait until the directory is empty would be
while [ `find /var/spool/postfix/active -type f -mmin -1` ]
do
sleep 1
done
Actually, the "-mmin -1" will make it wait at most one minute.
Or you wait at most 3 seconds, like this:
find /var/spool/postfix/active -type f -mmin -1 && sleep 1
find /var/spool/postfix/active -type f -mmin -1 && sleep 1
find /var/spool/postfix/active -type f -mmin -1 && sleep 1
Regards
Stephan
Am Dienstag, 26. Juni 2007 09:27 schrieb Xavier Parizet:
> On Tuesday 26 June 2007 08:54:39, "Gentoo Voyager"
> <[EMAIL PROTECTED]>
>
> wrote :
> > Dear all,
> > how to send automatic mail while halting the gentoo system.
> > qmail server running on my gentoo box.
>
> Maybe you can add a rc script to send an email at shutdown.
> For example :
> ===============/etc/init.d/notifyhalt========================
> #!/sbin/runscript
>
> EMAIL="[EMAIL PROTECTED]"
>
> depend () {
> need net
> }
>
> start () {
> return
> }
>
> stop () {
> ebegin "Notifying $EMAIL of rebooting the system"
> cat <<EOF | sendmail $EMAIL
> From: [EMAIL PROTECTED]
> Subject: System reboot
>
> The system is rebooting !
> EOF
> eend $?
> }
> ===================================================
> Add it by rc-update add notifyhalt default
> Hope this can help !
>
> > Thanks,
>
> Regards,
> Xavier Parizet
>
> --
> http://www.linuxant.fr
--
[EMAIL PROTECTED] mailing list