summaryrefslogtreecommitdiff
path: root/debian/examples/network/if-down.d/sendmail.1.old
blob: 88e719eaee4223023dd419a594e7ed6d40f6b136 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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;

# Purge any latent host status that might cause us to *NOT* send mail
AM='-Am';
if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
	AM='';
	fi;
sendmail $AM -bH -O Timeout.hoststatus=1s;

# New mail will only be queued
file="/etc/mail/dialup.m4";
if [ -f "$file" ]; then
	cat <<-EOT > $file;
		LOCAL_CONFIG
		#------------------------------------------------------------
		#
		# Dynamic updates from $0
		#
		# NOTE: the following line *MUST* be in /etc/mail/sendmail.mc
		dnl include(\`/etc/mail/dialup.m4')dnl
		#
		# sendmail is to only queue messages until connected again
		define(\`confDELIVERY_MODE', \`deferred')dnl
		#
		# Allow the queue to age without carping every four hours
		define(\`confTO_QUEUEWARN',\`1d')dnl
		#
		# Don't keep host status while the network is down
		define(\`confHOST_STATUS_DIRECTORY')dnl
		#------------------------------------------------------------
		EOT
	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 /etc/mail/sendmail.mc \
	> /etc/mail/sendmail.cf.pnew;
chmod 0644 /etc/mail/sendmail.cf.pnew;
chown mail: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;