--- sendmail 2010-08-12 15:43:07.048566686 +0100 +++ sendmail.mail1 2010-08-13 12:02:45.205084712 +0100 @@ -1,6 +1,6 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: sendmail +# Provides: sendmail.mail1 # Required-Start: $remote_fs $network $syslog # Required-Stop: $remote_fs $network $syslog # Default-Start: 2 3 4 5 @@ -17,19 +17,21 @@ ### END INIT INFO # Author: Marc-Christian Petersen +# Modified: Sam Pointer PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Mail Transport Agent (MTA)" NAME=sendmail +INSTANCE=mail1 DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" -SCRIPTNAME=/etc/init.d/$NAME +SCRIPTNAME=/etc/init.d/$NAME.$INSTANCE # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present -[ -r /etc/default/sendmail ] && . /etc/default/sendmail +[ -r /etc/default/sendmail.$INSTANCE ] && . /etc/default/sendmail.$INSTANCE # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh @@ -59,17 +61,17 @@ # Support stand-alone execution if [ -z "$DAEMON" ]; then PATH=/bin:/usr/bin:/sbin:/usr/sbin - DESC="Mail Transport Agent (MTA)" + DESC="Mail Transport Agent (MTA) $INSTANCE" NAME=sendmail DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" - SCRIPTNAME=/etc/init.d/$NAME + SCRIPTNAME=/etc/init.d/$NAME.$INSTANCE # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present - [ -r /etc/default/sendmail ] && . /etc/default/sendmail + [ -r /etc/default/sendmail.$INSTANCE ] && . /etc/default/sendmail.$INSTANCE # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh @@ -105,7 +107,7 @@ # Secondary (non-documented) parameters in /etc/mail/sendmail.conf # Caveat Emptor: change these at your own risk - they impact several # disjoint pieces parts... - SENDMAIL_ROOT='/var/run/sendmail'; + SENDMAIL_ROOT="/var/run/sendmail.$INSTANCE"; MTA_DAEMON='/usr/sbin/sendmail-mta'; MTA_COMMAND='/usr/sbin/sendmail-mta'; MTA_A='-Am'; @@ -132,8 +134,8 @@ MSP_CNTL="${MSP_ROOT}/smcontrol"; # Pull in any user modified variables - if [ -f /etc/mail/sendmail.conf ]; then - . /etc/mail/sendmail.conf; + if [ -f /etc/mail/servers/$INSTANCE/sendmail.conf ]; then + . /etc/mail/servers/$INSTANCE/sendmail.conf; fi; # These can't be user customized @@ -629,10 +631,10 @@ result=1; if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then result=1; - elif [ -s /etc/mail/submit.cf ] \ - && [ -s /etc/mail/submit.mc ]; then + elif [ -s /etc/mail/servers/$INSTANCE/submit.cf ] \ + && [ -s /etc/mail/servers/$INSTANCE/submit.mc ]; then if grep -qEe "^[[:space:]]*\`?FEATURE\([[:space:]]*\`?msp" \ - /etc/mail/submit.mc; then + /etc/mail/servers/$INSTANCE/submit.mc; then result=0; fi; fi; @@ -698,17 +700,17 @@ echo 'MSP statistics...'; #check if we have a status file for the MSP statusfile=$(grep -Ee '^O StatusFile=/.*' \ - /etc/mail/submit.cf | cut -d= -f2); + /etc/mail/servers/$INSTANCE/submit.cf | cut -d= -f2); if [ -n $statusfile ]; then /usr/lib/sm.bin/mailstats -C \ - /etc/mail/submit.cf $* || true; + /etc/mail/servers/$INSTANCE/submit.cf $* || true; fi; echo 'MTA statistics...'; fi; # # check if we have a status file for the MTA statusfile=$(grep -Ee '^O StatusFile=/.*' \ - /etc/mail/sendmail.cf | cut -d= -f2); + /etc/mail/servers/$INSTANCE/sendmail.cf | cut -d= -f2); if [ -n $statusfile ]; then /usr/lib/sm.bin/mailstats $* || true; fi; @@ -727,7 +729,7 @@ # # Check to see if shared memory is in use (8.12.0+) if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \ - /etc/mail/submit.mc; then + /etc/mail/servers/$INSTANCE/submit.mc; then $MSP_COMMAND -bP || true; fi; $MSP_COMMAND -bp $MSP_A $MISC_PARMS $* || true; @@ -736,7 +738,7 @@ # # Check to see if shared memory is in use (8.12.0+) if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \ - /etc/mail/sendmail.mc; then + /etc/mail/servers/$INSTANCE/sendmail.mc; then $MTA_COMMAND -bP || true; fi; $MTA_COMMAND -bp $MTA_A $MISC_PARMS $* || true; @@ -940,8 +942,7 @@ # Skip daemon run for the following: # * sendmail hasn't been configured # * DAEMON_MODE = (none | inet) & QUEUE_MODE = (none | cron) - if [ ! -s /etc/mail/sendmail.cf ] || \ - [ ! -s /etc/mail/sendmail.mc ]; then + if [ ! -s /etc/mail/servers/$INSTANCE/sendmail.cf ]; then log_failure_msg 'Not configured, not started.'; return 1; fi; @@ -1007,8 +1008,8 @@ make_databases () { # # Life is so much simpler with make - if test -x /usr/bin/make -a -f /etc/mail/Makefile; then - /usr/bin/make all -s -C /etc/mail >/dev/null; + if test -x /usr/bin/make -a -f /etc/mail/servers/$INSTANCE/Makefile; then + /usr/bin/make all -s -C /etc/mail/servers/$INSTANCE >/dev/null; # # Here, all I could do would be handle a *few* database - # quite frankly, it isn't worth it, someone will want yet another @@ -1028,8 +1029,8 @@ local QUEUE_ROOT QUEUE QUIET # Obtain queue root directory if [ -z "$1" ]; then - QUEUE_ROOT=/var/spool/mqueue - QUEUE=/var/spool/mqueue + QUEUE_ROOT=/var/spool/mqueue.$INSTANCE + QUEUE=/var/spool/mqueue.$INSTANCE QUIET='' else QUEUE_ROOT="$1" @@ -1175,19 +1176,19 @@ # Debian required/optional targets: #----------------------------------------------------------------------- start) - log_daemon_msg "Starting $DESC" "$NAME"; + log_daemon_msg "Starting $DESC $INSTANCE" "$NAME"; start_sendmail; log_end_msg $?; ;; stop|force-stop) - log_daemon_msg "Stopping $DESC" "$NAME"; + log_daemon_msg "Stopping $DESC $INSTANCE" "$NAME"; stop_sendmail; log_end_msg $?; ;; restart) - log_daemon_msg "Restarting $DESC" "$NAME"; + log_daemon_msg "Restarting $DESC $INSTANCE" "$NAME"; # reload is equivalent (but faster) than stop/start ! # but... it doesn't honor changes to /etc/mail/sendmail.conf #reload_sendmail; @@ -1213,7 +1214,7 @@ ;; reload|force-reload) - log_daemon_msg "Reloading $DESC" "$NAME"; + log_daemon_msg "Reloading $DESC $INSTANCE" "$NAME"; reload_sendmail; log_end_msg $?; ;;