templates/default/clamd.init.rhel.erb
#! /bin/bash
#
# crond Start/Stop the clam antivirus daemon.
#
# chkconfig: 2345 70 41
# description: clamd is a standard Linux/UNIX program that scans for Viruses.
#
# processname: clamd
# config: <%= @clamd_conf %>
# pidfile: <%= @clamd_pid %>
# Source function library
. /etc/init.d/functions
# Get network config
. /etc/sysconfig/network
prog="clamd"
progdir="<%= @clamd_bin_dir %>"
conf="<%= @clamd_conf %>"
pid="<%= @clamd_pid %>"
lock="/var/lock/subsys/$prog"
test -f $conf || exit 1
# Source configuration
if [ -f /etc/sysconfig/$prog ]; then
. /etc/sysconfig/$prog
fi
start() {
echo -n $"Starting $prog: "
daemon $progdir/$prog -c $conf
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lock && success || failure
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
# Would be better to send QUIT first, then killproc if that fails
killproc $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $pid $lock && success || failure
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading clam daemon configuration: "
killproc clamd -HUP
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
status $prog
;;
condrestart)
[ -f $pid ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
exit 1
esac
exit $?