summaryrefslogtreecommitdiff
path: root/debian/local/ip-down.d
blob: 1881437adebbcd7ed68b2ab3d5bc8649e28ddfeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# This script is called when ppp disconnects from the network.
#        
# Here is where we'll stop sendmail if needed
#
# Written By Richard Nelson <cowboy@debian.org>
#
# NOTE: The following lines (without the #) must be in /etc/mail/sendmail.mc:
# include(`/etc/mail/dialup.m4')dnl
# include(`/etc/mail/provider.m4')dnl
#
# Exit by default, check for validity before commenting out the next line:
exit 0

# New mail will only be queued
file="/etc/mail/dialup.m4"
if [ -f "$file" ]; then
   echo "LOCAL_CONFIG" >> $file
   echo "#------------------------------------------------------------" >> $file
   echo "#" > $file
   echo "# Dynamic updates from $0" >> $file
   echo "#" >> $file
   echo "# sendmail is to only queue messages until connected again" >> $file
   echo "define(\`confDELIVERY_MODE', \`deferred')dnl" >> $file
   echo "# Allow the queue to age without carping every four hours" >> $file
   echo "define(\`confTO_QUEUEWARN',\`1d')dnl" >> $file
   echo "# Don't keep host status while the network is down" >> $file
   echo "define(\`confHOST_STATUS_DIRECTORY')dnl" >> $file
   echo "#------------------------------------------------------------" >> $file
   fi

# Build a new sendmail.cf from sendmail.mc, including our address.
# NOTE: The following line (without the #) must be in /etc/mail/sendmail.mc:
# include(`/etc/mail/dialup.m4')
m4 /usr/share/sendmail/sendmail.cf/m4/cf.m4 /etc/mail/sendmail.mc \
        >/etc/mail/sendmail.cf.pnew
chmod 0640 /etc/mail/sendmail.cf.pnew
chown root.mail /etc/mail/sendmail.cf.pnew
mv -f /etc/mail/sendmail.cf.pnew /etc/mail/sendmail.cf

# Stop/reload sendmail daemon as needed
/etc/init.d/sendmail reload