Path : /etc/rc1.d/ |
|
Current File : //etc/rc1.d/K31clamd |
#!/bin/sh
# clamd This will start and stop clamd when exim is disabled.
#
# chkconfig: 35 81 31
# description: clamd antivirus daemon
# processname: clamd
# config: /usr/local/cpanel/3rdparty/etc/clamd.conf
# pidfile: /var/run/clamd.pid
CLAMD_BIN='/usr/local/cpanel/3rdparty/bin/clamd'
CLAMD_SOCKET='/var/clamd'
# When enabled, the exim init script will start and stop clamd.
if [ -e '/etc/rc.d/init.d/exim' -a ! -e '/etc/eximdisable' ]; then
echo "clamd is managed by the exim service"
exit 0
fi
if [ ! -x "$CLAMD_BIN" ]; then
exit 0
fi
if [ -e '/etc/clamddisable' ] ; then
CLAMD_DISABLED=1
else
unset CLAMD_DISABLED
fi
RETVAL=0
DAEMONIZE='daemon'
# Source function library.
if [ -e "/etc/init.d/functions" ]; then
. /etc/init.d/functions
else
if [ -e "/etc/rc.d/init.d/functions" ]; then
. /etc/rc.d/init.d/functions
fi
fi
if [ -f /etc/sysconfig/clamd ] ; then
. /etc/sysconfig/clamd
fi
# Override any LANG setting
LANG=C
export LANG
RETVAL=0
stop() {
[ "$CLAMD_DISABLED" == "" ] && echo -n "Stopping clamd: "
killproc clamd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
rm -f $CLAMD_SOCKET
}
start() {
if [ "$CLAMD_DISABLED" == "" ]; then
echo -n "Starting clamd: "
$DAEMONIZE $CLAMD_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
echo
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
$0 stop
$0 start
;;
status)
status clamd
;;
*)
echo "Usage: clamd {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
@KyuuKazami