killproc mailscanner

Steve Bassi steve at BASSI.COM
Fri Sep 6 06:24:52 IST 2002


----- Original Message -----
From: "Craig St George" <craig at WEBFARM.CO.NZ>
To: <MAILSCANNER at JISCMAIL.AC.UK>
Sent: Friday, September 06, 2002 1:18 AM
Subject: killproc mailscanner


> Ok it is defiantly a cobalt RAQ thing
>
> when you ue init script and then do a ps awx
> it shows
> perl /home/opt/MailScanner/bin/mailscanner /home/opt/
>
> so killproc mail scanner does not work nor does status
>
> I just changed init script so to kill  via the PID
>
>
> # Stop daemons.
>          echo    'Shutting down MailScanner daemons:'
>
>          [ -f  /home/opt/MailScanner/var/virus.pid ] && {
>              kill `cat  /home/opt/MailScanner/var/virus.pid`
>             echo -n '  MailScanner:       '
>          }
>          rm -f  /home/opt/MailScanner/var/virus.pid
>          echo
>
>
>
> and status
>
>
> # Work out if all of MailScanner is running
>          echo    'Checking MailScanner daemons:'
>          echo -n '         MailScanner:       '
>          pid=`ps ax |grep  '/home/opt/MailScanner'`
>          if [ -z "$pid" ] ; then failure; else success; fi
>          echo
>
>
That did not seem to solve it completely for me on my RAQ, so this is what I
did.
I am sure there is a better and neater way  .. but hey it works for me.


Rgds

Steve Bassi

stop)
        # Stop daemons.
        echo    'Shutting down MailScanner daemons:'
        [ -f  /home/opt/MailScanner/var/virus.pid ] && {
        kill -1 `cat /home/opt/MailScanner/var/virus.pid`
        }
        rm -f  /home/opt/MailScanner/var/virus.pid
        echo -n '              MailScanner:       '
        pid=`ps -axww | grep "/MailScanner" | grep -v "grep" | head -1 | awk
{'print $1'}`;
        if [ -z "$pid" ] ; then success; else failure; fi
        echo
        echo -n '              incoming sendmail: '
        killproc sendmail 2>/dev/null
        echo
        echo -n '              outgoing sendmail: '
        killproc /usr/sbin/sendmail 2>/dev/null
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mailscanner
        ;;
  status)
        # Work out if all of MailScanner is running
        echo    'Checking MailScanner daemons:'
        echo -n '         MailScanner:       '
        pid=`ps -axww | grep "/MailScanner" | grep -v "grep" | head -1 | awk
{'print $1'}`;
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        # Now the incoming sendmail
        echo -n '         incoming sendmail: '
        pid=`ps ax | grep 'sendmai[l]: accepting connections'`
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        # Now the outgoing sendmail
        echo -n '         outgoing sendmail: '
        # More complex regexp to handle other RedHats
        pid=`ps ax | egrep '\[sendmail\]|sendmai[l] -q[0-9]*[mhd]'`
        if [ -z "$pid" ] ; then failure; else success; fi
        echo
        ;;



More information about the MailScanner mailing list