options='
clamd clamav-daemon clamav /usr/sbin/clamd clamav/clamd.pid 5 clamav.log
amavis amavis.amavisd-new amavis amavisd \\(master\\) amavis/amavisd.pid 5 socket
-milter amavisd-new-milter amavis /usr/sbin/amavis-milter amavis/amavisd-new-milter.pid 5 socket
'
# note: pgrep -f takes a regexp, and this is shell expanded once, hence \\
IFS="$IFSOLD"
num=${num:-4}
sleep=${sleep:-1}
- maxtry=${maxtry:-10}
+ maxtry=${maxtry:-90}
if [ -n "$pidfile" ]; then
pidfile=/var/run/$pidfile
findpid="[ -f $pidfile ] && cat $pidfile || true"
do
sleep $sleep # 1st, give it a chance to run
pid=`eval $findpid` # 2nd: find it
- [ -z "$pid" ] && return 1 # not running at all
- count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l` # 3rd: count all it's worth
- [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
- && return # success -- release
+ if [ ! -z "$pid" ]; then
+ count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l` # 3rd: count all it's worth
+ [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
+ && return # success -- release
+ fi
try=$(($try+1))
[ "0$try" -ge "0$maxtry" ] && return 1 # no luck this time
done
# If there's no diversion, play possum
[ -x /etc/init.d/amavis.amavisd-new ] || exit 0
-if [ -x /etc/init.d/postfix -a -x /usr/lib/postfix/master ]; then
- mta=postfix
-else
- mta=sendmail
-fi
+mta=postfix
case "$arg" in
start|stop|restart|reload|force-reload)
istart)
start clamd
start amavis
- [ $mta = sendmail ] && start milter
/etc/init.d/$mta start
;;
istop)
/etc/init.d/$mta stop
- [ $mta = sendmail ] && stop milter
stop amavis
stop clamd
;;