#!/bin/sh # description: start/stop sendmail milter plugin milter-regex # # default: S/K40 0/K40 1/K40 2/S87 # ACCOUNT, under which the milter should run ACCOUNT=smmsp # configuration file CONF=/etc/mail/milter-regex.conf SOCKET=local:/var/milter/milter-regex.sock # If "yes", log verbose to syslog with mail.debug # Make sure, you have a lot of space on your logging device, when enabling # this option !!! VERBOSE="no" # # no further changes should be required # MILTERDIR=@CLIENT_BASEDIR@ case "$1" in 'start') echo "Starting milter-regex sendmail filter ..." if [ ! -x ${MILTERDIR}/sbin/milter-regex ]; then echo "failed (unable to execute ${MILTERDIR}/sbin/milter-regex)." exit 1 fi if [ ! -r ${CONF} ]; then echo "failed (unable to read config $CONF)." exit 2 fi PIDS=`pgrep -x -u $ACCOUNT -P 1 milter-regex` if [ -n "$PIDS" ]; then echo "is already running." exit 0; fi if [ "$VERBOSE" = "yes" ]; then OPT="-d" else OPT="" fi ${MILTERDIR}/sbin/milter-regex -c $CONF $OPT -p ${SOCKET} if [ $? -ne 0 ]; then echo "failed." else echo "done." fi ;; 'stop') echo "Stopping milter-regex sendmail filter ..." pkill -9 -x -u $ACCOUNT -P 1 milter-regex echo "done." ;; *) echo "Usage: $0 { start | stop }" exit 1 ;; esac exit 0