public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Gentoo Halt message
@ 2007-06-26  6:54 Gentoo Voyager
  2007-06-26  7:27 ` [gentoo-user] " Xavier Parizet
  2007-06-29 16:24 ` [gentoo-user] " Vladimir Rusinov
  0 siblings, 2 replies; 5+ messages in thread
From: Gentoo Voyager @ 2007-06-26  6:54 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

Dear all,
how to send automatic mail while halting the gentoo system. qmail server
running on my gentoo box.

Thanks,

-- 
"Try to  be a Buddhist..!!"

[-- Attachment #2: Type: text/html, Size: 201 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gentoo-user] Re: Gentoo Halt message
  2007-06-26  6:54 [gentoo-user] Gentoo Halt message Gentoo Voyager
@ 2007-06-26  7:27 ` Xavier Parizet
  2007-06-30  7:38   ` Stephan Wacker
  2007-06-29 16:24 ` [gentoo-user] " Vladimir Rusinov
  1 sibling, 1 reply; 5+ messages in thread
From: Xavier Parizet @ 2007-06-26  7:27 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On Tuesday 26 June 2007 08:54:39, "Gentoo Voyager" <gentoovoyager@gmail.com> 
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="root@server.net"

depend () {
	need net
}

start () {
	return
}

stop () {
	ebegin "Notifying $EMAIL of rebooting the system"
	cat <<EOF  | sendmail $EMAIL
From: halt.notify@server.net
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 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Gentoo Halt message
  2007-06-26  6:54 [gentoo-user] Gentoo Halt message Gentoo Voyager
  2007-06-26  7:27 ` [gentoo-user] " Xavier Parizet
@ 2007-06-29 16:24 ` Vladimir Rusinov
  1 sibling, 0 replies; 5+ messages in thread
From: Vladimir Rusinov @ 2007-06-29 16:24 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

On 6/26/07, Gentoo Voyager <gentoovoyager@gmail.com> wrote:
>
> Dear all,
> how to send automatic mail while halting the gentoo system. qmail server
> running on my gentoo box.
>

I tried this. Usually this e-mails won't sent until the server up: my system
hats fatser than mail sends. You may add delay, but as for me, this is bad
solution.

-- 
Vladimir Rusinov
GreenMice Solutions: IT-решения на базе Linux
http://greenmice.info/

[-- Attachment #2: Type: text/html, Size: 816 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Re: Gentoo Halt message
  2007-06-26  7:27 ` [gentoo-user] " Xavier Parizet
@ 2007-06-30  7:38   ` Stephan Wacker
  2007-06-30  8:47     ` Neil Bothwick
  0 siblings, 1 reply; 5+ messages in thread
From: Stephan Wacker @ 2007-06-30  7:38 UTC (permalink / raw
  To: gentoo-user

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"
> <gentoovoyager@gmail.com>
>
> 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="root@server.net"
>
> depend () {
> 	need net
> }
>
> start () {
> 	return
> }
>
> stop () {
> 	ebegin "Notifying $EMAIL of rebooting the system"
> 	cat <<EOF  | sendmail $EMAIL
> From: halt.notify@server.net
> 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
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Re: Gentoo Halt message
  2007-06-30  7:38   ` Stephan Wacker
@ 2007-06-30  8:47     ` Neil Bothwick
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Bothwick @ 2007-06-30  8:47 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hello Stephan Wacker,

>     while [ `find /var/spool/postfix/active -type f -mmin -1` ]

find returns success if it finds no files, so this will loop forever. Use [[ $(find blah | wc -l) -gt 0 ]]


-- 
Neil Bothwick

The world is a tragedy to those who feel, but a comedy to those who
think.(Horace Walpole)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-30  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26  6:54 [gentoo-user] Gentoo Halt message Gentoo Voyager
2007-06-26  7:27 ` [gentoo-user] " Xavier Parizet
2007-06-30  7:38   ` Stephan Wacker
2007-06-30  8:47     ` Neil Bothwick
2007-06-29 16:24 ` [gentoo-user] " Vladimir Rusinov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox