Rich,

I just went into /etc/init.d/clamav-milter and took out some of the 
--pidfile stuff. This is on a Debian system. Here is a copy of my 
/etc/init.d/clamav-milter file - it works for me, don't know if it is the 
way it should be.
-----------------------------------------------------------------------------------


#!/bin/sh
### BEGIN INIT INFO
# Provides:          clamav-milter
# Required-Start:    $syslog
# Should-Start:      clamav-daemon
# Required-Stop:
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 6
# Short-Description: ClamAV virus milter
# Description:       Clam AntiVirus milter interface
### END INIT INFO

# edit /etc/default/clamav-milter for /options

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/clamav-milter
DESC="Sendmail milter plugin for ClamAV"
BASENAME=clamav-milter
CLAMAVCONF=/etc/clamav/clamav-milter.conf
#DEFAULT=/etc/default/clamav-milter
SUPERVISOR=/usr/bin/daemon
SUPERVISORPIDFILE="/var/run/clamav/daemon-clamav-milter.pid"
SUPERVISORARGS="-F $SUPERVISORPIDFILE --name=$BASENAME --respawn"
CLAMAVDAEMONUPGRADE="/var/run/clamav-daemon-being-upgraded"

[ -x "$DAEMON" ] || exit 0
#[ ! -r $DEFAULT ] || . $DEFAULT

. /lib/lsb/init-functions

if [ ! -f "$CLAMAVCONF" ]; then
   log_failure_msg "There is no configuration file for clamav-milter."
   log_failure_msg "Please either dpkg-reconfigure $DESC, or copy the example 
from"
   log_failure_msg "/usr/share/doc/clamav-milter/examples/ to $CLAMAVCONF and 
run"
   log_failure_msg "'/etc/init.d/clamav-milter start'"
   exit 0
fi

to_lower()
{
   word="$1"
   lcword=$(echo "$word" | tr A-Z a-z)
   echo "$lcword"
}

is_true()
{
   var="$1"
   lcvar=$(to_lower "$var")
   [ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ]
   return $?
}

ucf_cleanup()
{
   # This only does something if I've fucked up before
   # Not entirely impossible :(

   configfile=$1

   if [ `grep "$configfile" /var/lib/ucf/hashfile | wc -l` -gt 1 ]; then
     grep -v "$configfile" /var/lib/ucf/hashfile > /var/lib/ucf/hashfile.tmp
     grep "$configfile" /var/lib/ucf/hashfile | tail -n 1  >> 
/var/lib/ucf/hashfile.tmp
     mv /var/lib/ucf/hashfile.tmp /var/lib/ucf/hashfile
   fi
}

add_to_ucf()
{
   configfile=$1
   ucffile=$2

   if ! grep -q "$configfile" /var/lib/ucf/hashfile; then
     md5sum $configfile >> /var/lib/ucf/hashfile
     cp $configfile $ucffile
   fi
}

ucf_upgrade_check()
{
   configfile=$1
   sourcefile=$2
   ucffile=$3

   if [ -f "$configfile" ]; then
     add_to_ucf $configfile $ucffile
     ucf --three-way --debconf-ok "$sourcefile" "$configfile"
   else
     [ -d /var/lib/ucf/cache ] || mkdir -p /var/lib/ucf/cache
     cp $sourcefile $configfile
     add_to_ucf $configfile $ucffile
   fi
}

slurp_config()
{
   CLAMAVCONF="$1"

   if [ -e "$CLAMAVCONF" ]; then
     for variable in `egrep -v '^[[:space:]]*(#|$)' "$CLAMAVCONF" | awk '{print 
$1}'`; do
       if [ "$variable" = 'DatabaseMirror' ]; then
         if [ -z "$DatabaseMirror" ]; then
           for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
             value="$i $value"
           done
         else
           continue
         fi
       elif [ "$variable" = 'IncludePUA' ]; then
         if [ -z "$IncludePUA" ]; then
           for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
             value="$i $value"
           done
         else
           continue
         fi
       elif [ "$variable" = 'ExcludePUA' ]; then
         if [ -z "$ExcludePUA" ]; then
           for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
             value="$i $value"
           done
         else
           continue
         fi
       elif [ "$variable" = 'VirusEvent' ] || [ "$variable" = 'OnUpdateExecute' 
] || [ "$variable" = 'OnErrorExecute' ]; then
         value=`grep ^$variable $CLAMAVCONF | head -n1 | sed -e s/$variable\ //`
       else
         value=`grep ^$variable $CLAMAVCONF | head -n1 | awk '{print $2}'`
       fi
       if [ -z "$value" ]; then
         export "$variable"="true"
       elif [ "$value" != "$variable" ]; then
         export "$variable"="$value"
       else
         export "$variable"="true"
       fi
       unset value
     done
   fi
}

make_dir()
{
   DIR=$1
   if [ -d "$DIR" ]; then
     return 0;
   fi
   [ -n "$User" ] || User=clamav
   mkdir -p -m 0755 "$DIR"
   chown "$User:$User" "$DIR"
}



slurp_config "$CLAMAVCONF"
[ -n "$User" ] || User=clamav

if [ -n "$Example" ]; then
   log_failure_msg "$DESC is not configured."
   log_failure_msg "Please edit $CLAMAVCONF and run '/etc/init.d/clamav-milter 
start'"
   exit 0
fi

if [ -z "$PidFile" ]; then
   PIDFILE=/var/run/clamav/clamav-milter.pid
else
   PIDFILE="$PidFile"
fi

if [ -z "$MilterSocket" ]; then
   SOCKET=local:/var/run/clamav/clamav-milter.ctl
else
   SOCKET="$MilterSocket"
fi

case "$SOCKET" in
   /*)
   SOCKET_PATH="$SOCKET"
   SOCKET="local:$SOCKET"
   ;;
   *)
   SOCKET_PATH=`echo $SOCKET | sed -e s/local\://`
   # If the socket is type inet: we don't care - we can't rm -f that later :)
   ;;
esac

if is_true "$Foreground"; then
   if [ ! -x "$SUPERVISOR" ] ; then
      log_failure_msg "Foreground specified, but $SUPERVISOR not found"
      exit 0
   else
      RUN_SUPERVISED=1
      SUPERVISOR_EXEC="$DAEMON"
   fi
fi

if [ -z "$RUN_SUPERVISED" ] ; then
   if [ -f "$PIDFILE" ]; then
     PID=`pidofproc -p $PIDFILE $DAEMON`
     RUNNING=$?
   else
     PID=`pidofproc $DAEMON`
     RUNNING=$?
   fi
else
   [ -e "$SUPERVISORPIDFILE" ] && PID=`sed 's/[^0-9]//g' $SUPERVISORPIDFILE`
fi

[ "$PID" = '1' ] && unset PID
[ -n "$User" ] || User=clamav
[ -n "$DataBaseDirectory" ] || DataBaseDirectory=/var/run/clamav

make_dir "$DataBaseDirectory"
if [ "${SOCKET_PATH#inet}" = "${SOCKET_PATH}" ]; then
   make_dir $(dirname "$SOCKET_PATH")
   chown $User $(dirname "$SOCKET_PATH")
fi

make_dir $(dirname "$PIDFILE")
chown $User $(dirname "$PIDFILE")

case "$1" in
   start)
   OPTIND=1
   if [ -n "$PID" ]; then
     PID=`echo $PID | sed 's/[^0-9]//g'`
     if kill -0 $PID; then
       log_failure_msg "$DAEMON already running"
       exit 1
     fi
   fi
   if [ -e "$CLAMAVDAEMONUPGRADE" ] && [ "$RESTART_AFTER_CLAMD" = 'yes' ]; then
     touch $CLAMAVDAEMONUPGRADE.milter-restart
     log_warning_msg "clamd may be required to run $DAEMON, clamav-milter will 
be restarted by clamav-daemon"
     exit 0
   fi
   if [ -z "$RUN_SUPERVISED" ] ; then
     log_daemon_msg "Starting $DESC" "$BASENAME"
     su "$User" -p -s /bin/sh -c ". /lib/lsb/init-functions && start_daemon 
$DAEMON" > /dev/null
     ret=$?
   else
     log_daemon_msg "Starting $DESC" "$BASENAME (supervised)"
     $SUPERVISOR $SUPERVISORARGS -X "$SUPERVISOR_EXEC"
     ret=$?
   fi
   if [ $ret = 0 ] && [ "$USE_POSTFIX" = 'yes' ] && [ "${SOCKET_PATH#inet}" = 
"${SOCKET_PATH}" ]; then
     cnt=0
     until [ -e "$SOCKET_PATH" ] ; do
       cnt=`expr "$cnt" + 1`
       if [ "$cnt" -gt 15 ]; then
         break
       fi
       sleep 2
     done
     if [ -e "$SOCKET_PATH" ]; then
       chmod g+w $SOCKET_PATH
       chgrp postfix $SOCKET_PATH
     else
       log_warning_msg "Socket not created.  Investigate"
     fi
   fi
   log_end_msg $ret
   ;;
   stop)
   OPTIND=1
   log_daemon_msg "Stopping $DESC" "$BASENAME"
   if [ -n "$PID" ]; then
     PID=`echo $PID | sed 's/[^0-9]//g'`
     kill -15 -"$PID" 2>/dev/null || true
     ret=$?
     sleep 2
     if kill -0 "$PID" 2>/dev/null; then
       ret=$?
       log_progress_msg "Waiting . "
       cnt=0
       while kill -0 "$PID" 2>/dev/null; do
         ret=$?
         cnt=`expr "$cnt" + 1`
         if [ "$cnt" -gt 15 ]; then
           kill -9 -"$PID"
           ret=$?
           break
         fi
         sleep 2
         log_progress_msg ". "
       done
     fi
   else
     if [ -z "$RUN_SUPERVISED" ] ; then
       killproc -p $PIDFILE $DAEMON
       ret=$?
     else
       killproc -p $SUPERVISORPIDFILE
       ret=$?
     fi
   fi
   if [ -n "$ret" ]; then
     log_end_msg $ret
   else
     log_end_msg $?
   fi
   [ -e "$SOCKET_PATH" ] && rm -f $SOCKET_PATH
   [ -e "$PIDFILE" ] && rm -f $PIDFILE
   ;;
   force-reload | restart)
   $0 stop
   sleep 2
   $0 start
   ;;
   status)
   status_of_proc "$DAEMON" "$NAME"
   exit $?
   ;;
   *)
   log_failure_msg "Usage: $0 {start|stop|restart|force-reload|status}" >&2
   exit 1
   ;;
esac

exit 0





-----------------------------------------------------------------------------------------------------


On Thu, 30 Apr 2009, Gomes, Rich wrote:

> Does anyone have a fix for this?
>
> -----Original Message-----
> From: Gomes, Rich
> Sent: Tuesday, April 28, 2009 10:40 AM
> To: ClamAV users ML
> Subject: RE: [Clamav-users] [ClamAV-users] HELP!unrecognized option 
> `--pidfile=/var/run/clamav-milter/clamav-milter.pid'
>
> Thanks, this is a new install of OS and Sendmail\Clam so there is no 
> clamav-milter file in/etc/sysconfig
>
>
>
> One last ( I hope) thing:
>
> All mail is refused:
>
> Milter (clamav): error connecting to filter: Connection refused by 
> /var/clamav/clmilter.socket
> Milter (clamav): to error state
> Milter: initialization failed, temp failing commands
>
> Permissions on the directory:
>
> drwxr-xr-x  2 clamav clamav 4096 Apr 28 06:35 clamav
>
> (These are the same as the old server, which is running without issue, albeit 
> an older version)
>
> What else could cause this?
>
>
> Rich
>
> -----Original Message-----
> From: clamav-users-boun...@lists.clamav.net 
> [mailto:clamav-users-boun...@lists.clamav.net] On Behalf Of James Kosin
> Sent: Tuesday, April 28, 2009 10:27 AM
> To: ClamAV users ML
> Subject: Re: [Clamav-users] [ClamAV-users] HELP!unrecognized option 
> `--pidfile=/var/run/clamav-milter/clamav-milter.pid'
>
> Noel Jones wrote:
>> Gomes, Rich wrote:
>>> Line referring to the pid has been removed from the conf file but it
>>> still throws the same error Root owns the files, (same as the old
>>> mail server)
>>
>> Do NOT use the --pidfile *command line* option when starting
>> clamav-milter!  Please read the clamav-milter man page.
>>
>> You may need to change your init script.
>>
>>    -- Noel Jones
>> _______________________________________________
>
>
> Also, look for clamav-milter in /etc/sysconfig, if using any Fedora or RedHat 
> release.  Clamav-Milter no longer accepts command line arguments and all 
> parameters should be passed in the NEW clamav-milter.conf file located in /etc
>
> If you have the file 'clamav-milter' in /etc/sysconfig, either rename/remove 
> or comment out the CLAMAV_FLAGS part of the configuration file!!!  And please 
> EDIT the new /etc/clamav-milter.conf file to properly setup clamav-milter.
>
> James
>
> _______________________________________________
> Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
> http://www.clamav.net/support/ml
>
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml

Reply via email to