summaryrefslogtreecommitdiff
path: root/debian/local/ip-down.d
diff options
context:
space:
mode:
Diffstat (limited to 'debian/local/ip-down.d')
-rw-r--r--debian/local/ip-down.d43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/local/ip-down.d b/debian/local/ip-down.d
new file mode 100644
index 0000000..1881437
--- /dev/null
+++ b/debian/local/ip-down.d
@@ -0,0 +1,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