2024-01-05 21:23:32 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# freshclamd -- startup script for the Clam AntiVirus Database Update Daemon
|
|
|
|
#
|
|
|
|
# chkconfig: 2345 80 30
|
|
|
|
# description: Clam AntiVirus Database Update Daemon.
|
|
|
|
# processname: freshclamd
|
2024-01-05 21:23:32 +01:00
|
|
|
# pidfile: /run/clamav/freshclam.pid
|
2024-01-05 21:23:32 +01:00
|
|
|
# config: /etc/freshclam.conf
|
|
|
|
# config: /etc/clamd.conf
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
|
|
|
NAME=freshclam
|
|
|
|
DAEMON=/usr/bin/$NAME
|
2024-01-05 21:23:32 +01:00
|
|
|
DAEMONPID=/run/clamav/$NAME.pid
|
2024-01-05 21:23:32 +01:00
|
|
|
DAEMONCONF=/etc/freshclam.conf
|
2024-01-05 21:23:32 +01:00
|
|
|
OPTIONS="--config-file=$DAEMONCONF --quiet --daemon --pid=/run/clamav/freshclam.pid"
|
2024-01-05 21:23:32 +01:00
|
|
|
|
|
|
|
CLAMVDCONF=/etc/clamd.conf
|
|
|
|
|
|
|
|
[ -x $DAEMON ] || exit 0
|
|
|
|
|
|
|
|
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
|
|
|
|
|
|
|
|
# check if the clamv conf file is present
|
|
|
|
[ -r "$DAEMONCONF" ] || exit 0
|
|
|
|
|
|
|
|
USER=`grep '^User' $CLAMVDCONF | awk '{ print $2}'`
|
|
|
|
LOGFILE=`grep '^UpdateLogFile ' $DAEMONCONF | awk '{ print $2}'`
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n $"Starting Clam AntiVirus Update Daemon: "
|
|
|
|
touch ${LOGFILE}; chown ${USER}:${USER} ${LOGFILE}
|
|
|
|
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n $"Stopping Clam AntiVirus Update Daemon: "
|
|
|
|
killproc -p $DAEMONPID $NAME
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID
|
|
|
|
;;
|
|
|
|
restart|reload)
|
|
|
|
$0 stop
|
|
|
|
sleep 1
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
|
|
[ -e /var/lock/subsys/$NAME ] && $0 restart
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
statusproc $DAEMON
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|restart|condrestart}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|