Postfix init script? - for solaris (9)

James Davis jdavis at DOUGLAS.CO.US
Thu Aug 28 01:20:37 IST 2003


I'm using this for now - still working out what I want though.
Install it as /etc/init.d/postfix and make links like this:
cd /etc/init.d/rc2.d
ln -s ../init.d/postfix S90postfix
ln -s ../init.d/postfix K05postfix

I'm not in production yet - I'll post my final later.
Change paths as appropriate for your installation.

#!/sbin/sh
#
PATH=$PATH:/opt/spam/bin:/opt/spam/sbin:/opt/MailScanner/bin:/opt/ccs/bin:
export PATH

case "$1" in
'start')

 if [ -f /opt/spam/etc/postfix.in/main.cf ]; then
  echo "Starting inbound postfix"
  /opt/spam/sbin/postsuper -c /opt/spam/etc/postfix.in -s
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.in start
 fi
 if [ -f /opt/spam/etc/postfix.out/main.cf ]; then
  echo "Starting outbound postfix"
  /opt/spam/sbin/postsuper -c /opt/spam/etc/postfix.out -s
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.out start
 fi
 if [ -f /opt/MailScanner/etc/MailScanner.conf ]; then
  check_mailscanner
 fi
 ;;

'flush')
 # Remove postfix queue directories and rebuild!
 if [ -f /opt/spam/etc/postfix.in/main.cf ]; then
  echo "Rebuilding inbound postfix spool directories"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.in check
 fi
 if [ -f /opt/spam/etc/postfix.out/main.cf ]; then
  echo "Rebuilding outbound postfix spool directories"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.out check
 fi
 ;;

'reload')
 # Only reload postfix
 if [ -f /opt/spam/etc/postfix.in/main.cf ]; then
  echo "Reloading inbound postfix"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.in reload
 fi
 if [ -f /opt/spam/etc/postfix.out/main.cf ]; then
  echo "Reloading outbound postfix"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.out reload
 fi
 ;;

'stop')
 if [ -f /opt/spam/etc/postfix.in/main.cf ]; then
  echo "Stopping inbound postfix"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.in stop
 fi
 if [ -f /opt/spam/etc/postfix.out/main.cf ]; then
  echo "Stopping outbound postfix"
  /opt/spam/sbin/postfix -c /opt/spam/etc/postfix.out stop
 fi
 /usr/bin/pkill MailScanner
 sleep 1
 /usr/bin/pkill -9 MailScanner
 ;;

*)
 echo "Usage: $0 { start | stop }"
 exit 1
esac
exit 0



More information about the MailScanner mailing list