X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Finit;h=5ca8c67cd98991375d45dd6ad1711deb4d8845d7;hb=refs%2Fheads%2Flenny;hp=8af8212dfa618112f11ea1d90192909526fea5fc;hpb=1c3f285a0edf2971bb7fd75147e10bb66fb5323c;p=amavisd-cn.git diff --git a/debian/init b/debian/init index 8af8212..5ca8c67 100755 --- a/debian/init +++ b/debian/init @@ -7,7 +7,6 @@ set -e 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 \\ @@ -61,7 +60,7 @@ wait_for_fds () { 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" @@ -75,10 +74,11 @@ wait_for_fds () { 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 @@ -105,27 +105,21 @@ esac # 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) + start|stop|restart|reload|force-reload|debug) /etc/init.d/amavis.amavisd-new "$arg" ;; 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 ;;