clamav/clamav.init

72 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# Startup script for the Clam AntiVirus Daemon
#
# chkconfig: 2345 61 39
# description: Clam AntiVirus Daemon is a TCP/IP or socket protocol \
# server.
# processname: clamd
# pidfile: /var/run/clamav/clamd.pid
# config: /etc/clamav.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
[ -x /usr/sbin/clamd ] || exit 0
start(){
echo -n "Starting Clam AntiVirus Daemon: "
daemon clamd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
return $RETVAL
}
stop() {
echo -n "Stopping Clam AntiVirus Daemon: "
killproc clamd
rm -f /var/clamav/clamd.socket
rm -f /var/run/clamav/clamav.pid
RETVAL=$?
echo
### heres the fix... we gotta remove the stale files on restart
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status clamd
RETVAL=$?
;;
restart|reload)
restart
;;
condrestart)
[ -e /var/lock/subsys/clamd ] && $0 restart
RETVAL=$?
;;
*)
echo "Usage: clamd {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $RETVAL