ClamAV is an open source (GPLv2) anti-virus toolkit.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
clamav/contrib/init/SuSE/clamd

101 lines
2.4 KiB

#! /bin/sh
# v1.2 05-2004, martin fuxa, yeti@email.cz
#
### BEGIN INIT INFO
# Provides: clamd
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 2 6
# Description: Control clamav daemon.
### END INIT INFO
#
### HISTORY
# 2004-05-27 ADD - FreshClam code
# Variables
PID="/var/run/clamd.pid"
SBIN="/usr/local/sbin/clamd"
CONF="/etc/clamav.conf"
WHAT="Clam AntiVirus"
# START_FRESHCLAM value: 1=true, 0 false
START_FRESHCLAM=1
FRESHCLAM_SBIN="/usr/local/bin/freshclam"
FRESHCLAM_CONF="/etc/freshclam.conf"
FRESHCLAM_WHAT="FreshClam"
# Source SuSE config
. /etc/rc.status
test -x $SBIN || exit 5
test -e $CONF || exit 5
if [ $START_FRESHCLAM = 1 ]
then
test -x $FRESHCLAM_SBIN || exit 5
test -e $FRESHCLAM_CONF || exit 5
fi
# First reset status of this service
rc_reset
# Process request
case "$1" in
start)
if [ $START_FRESHCLAM = 1 ]
then
echo -n "Starting ${FRESHCLAM_WHAT} ${FRESHCLAM_CONF}"
startproc $FRESHCLAM_SBIN --daemon --config-file=${FRESHCLAM_CONF}
rc_status -v
fi
echo -n "Starting ${WHAT} ${CONF} "
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc $SBIN $CONF
# Remember status and be verbose
rc_status -v
## start freshclam
;;
stop)
echo -n "Shutting down ${WHAT}"
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM $SBIN
# Remember status and be verbose
rc_status -v
if [ $START_FRESHCLAM = 1 ]
then
echo -n "Shutting down ${FRESHCLAM_WHAT}"
killproc -TERM $FRESHCLAM_SBIN
rc_status -v
fi
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "Checking for ${WHAT} "
checkproc $SBIN
rc_status -v
if [ $START_FRESHCLAM = 1 ]
then
echo -n "Checking for ${FRESHCLAM_WHAT} "
checkproc $FRESHCLAM_SBIN
rc_status -v
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
### END