1 |
Hi, |
2 |
|
3 |
I would rather suggest you put the code into |
4 |
|
5 |
/etc/conf.d/local.stop |
6 |
|
7 |
That script is executed before anything in /etc/init.d is stopped. |
8 |
|
9 |
|
10 |
If you want to make sure the mail has left your system, you might |
11 |
test if the outgoing mail directory is empty. In my case that is |
12 |
|
13 |
/var/spool/postfix/active |
14 |
|
15 |
One way to wait until the directory is empty would be |
16 |
|
17 |
while [ `find /var/spool/postfix/active -type f -mmin -1` ] |
18 |
do |
19 |
sleep 1 |
20 |
done |
21 |
|
22 |
Actually, the "-mmin -1" will make it wait at most one minute. |
23 |
|
24 |
Or you wait at most 3 seconds, like this: |
25 |
|
26 |
find /var/spool/postfix/active -type f -mmin -1 && sleep 1 |
27 |
find /var/spool/postfix/active -type f -mmin -1 && sleep 1 |
28 |
find /var/spool/postfix/active -type f -mmin -1 && sleep 1 |
29 |
|
30 |
|
31 |
Regards |
32 |
Stephan |
33 |
|
34 |
|
35 |
Am Dienstag, 26. Juni 2007 09:27 schrieb Xavier Parizet: |
36 |
> On Tuesday 26 June 2007 08:54:39, "Gentoo Voyager" |
37 |
> <gentoovoyager@×××××.com> |
38 |
> |
39 |
> wrote : |
40 |
> > Dear all, |
41 |
> > how to send automatic mail while halting the gentoo system. |
42 |
> > qmail server running on my gentoo box. |
43 |
> |
44 |
> Maybe you can add a rc script to send an email at shutdown. |
45 |
> For example : |
46 |
> ===============/etc/init.d/notifyhalt======================== |
47 |
> #!/sbin/runscript |
48 |
> |
49 |
> EMAIL="root@××××××.net" |
50 |
> |
51 |
> depend () { |
52 |
> need net |
53 |
> } |
54 |
> |
55 |
> start () { |
56 |
> return |
57 |
> } |
58 |
> |
59 |
> stop () { |
60 |
> ebegin "Notifying $EMAIL of rebooting the system" |
61 |
> cat <<EOF | sendmail $EMAIL |
62 |
> From: halt.notify@××××××.net |
63 |
> Subject: System reboot |
64 |
> |
65 |
> The system is rebooting ! |
66 |
> EOF |
67 |
> eend $? |
68 |
> } |
69 |
> =================================================== |
70 |
> Add it by rc-update add notifyhalt default |
71 |
> Hope this can help ! |
72 |
> |
73 |
> > Thanks, |
74 |
> |
75 |
> Regards, |
76 |
> Xavier Parizet |
77 |
> |
78 |
> -- |
79 |
> http://www.linuxant.fr |
80 |
-- |
81 |
gentoo-user@g.o mailing list |