Re: [Clamav-users] clamav-milter startup script for Linux?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: up@3.am
Date:  
To: ClamAV users ML
Subject: Re: [Clamav-users] clamav-milter startup script for Linux?
On Mon, 22 Jun 2009, wrote:

> If somebody could share theirs, or point me to resources for it (and
> freshclam, while you're at it), I'd appreciate it.


Ok, rolling my own was easier than I thought...just steal most of it from
the clamd script. If anybody wants it, here it is (obviously, change
paths to match your system):

#! /bin/bash

# Source function library.
. /etc/init.d/functions

RETVAL=0

# See how we were called.

prog="clamav-milter"
progdir="/usr/sbin"

# Source configuration
if [ -f /etc/sysconfig/$prog ] ; then
    . /etc/sysconfig/$prog
fi

start() {
    echo -n $"Starting $prog: "
    daemon $progdir/$prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamav-milter
    return $RETVAL
}

stop() {
    echo -n $"Stopping $prog: "
    # Would be better to send QUIT first, then killproc if that fails
    killproc $prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamav-milter
    return $RETVAL
}

rhstatus() {
    status clamav-milter
}

restart() {
    stop
    start
}

reload() {
    echo -n $"Reloading clamav-milter daemon configuration: "
    killproc clamav-milter -HUP
    retval=$?
    echo
    return $RETVAL
}

case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    restart
    ;;
reload)
    reload
    ;;
status)
    rhstatus
    ;;
condrestart)
    [ -f /var/lock/subsys/clamav-milter ] && restart || :
    ;;
*)
    echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
    exit 1
esac

exit $?

James Smallacombe         PlantageNet, Inc. CEO and Janitor
                             http://3.am
=========================================================================
_______________________________________________
Help us build a comprehensive ClamAV guide: visit http://wiki.clamav.net
http://www.clamav.net/support/ml