diff options
author | Jamie Lenehan <lenehan@twibble.org> | 2006-10-05 08:00:52 +0000 |
---|---|---|
committer | Jamie Lenehan <lenehan@twibble.org> | 2006-10-05 08:00:52 +0000 |
commit | 1565969c4c85900f05c337b31bd9f27cc4b3aece (patch) | |
tree | cdd77635d12e9b10143efb25dd305af32dec0024 /packages/clamav/files/clamav-daemon.init | |
parent | 3e09934ece121e26e90b59e7397b126b937debec (diff) |
clamav 0.84: Simplify the init scripts. assume that the volatiles
processing takes care of the required directories and permissions in
/var, don't try and create the home directories when adding the clamav user.
Diffstat (limited to 'packages/clamav/files/clamav-daemon.init')
-rw-r--r-- | packages/clamav/files/clamav-daemon.init | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/packages/clamav/files/clamav-daemon.init b/packages/clamav/files/clamav-daemon.init index a70e14f3f4..bab7a184d7 100644 --- a/packages/clamav/files/clamav-daemon.init +++ b/packages/clamav/files/clamav-daemon.init @@ -1,64 +1,31 @@ #! /bin/sh -# This is a modified version of the debian clamav-daemon init script -set -e PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/clamd NAME="clamd" DESC="ClamAV daemon" CLAMAVCONF=/etc/clamd.conf -[ -x "$DAEMON" ] || exit 0 -[ -r /etc/default/clamav-daemon ] && . /etc/default/clamav-daemon +set -e -if [ ! -f "$CLAMAVCONF" ]; then - echo "There is no configuration file for $DESC." - exit 0; -fi -if grep -q "^Example" $CLAMAVCONF; then - echo "$DESC is not configured. Please edit $CLAMAVCONF" - exit 0 +test -r /etc/default/clamav-daemon && . /etc/default/clamav-daemon +test -x "$DAEMON" || exit 0 +test ! -r "$CLAMAVCONF" && exit 0 +if [ `grep -q "^Example" $CLAMAVCONF` ]; then + echo "$DESC is not configured." + exit 0 fi - -THEPIDFILE="`grep ^PidFile $CLAMAVCONF | awk '{print $2}'`" -[ -e "$THEPIDFILE" ] && PID=`cat $THEPIDFILE` -[ "$PID" = '1' ] && unset PID - -# Make sure dirs exist and are correct -for i in /var/run/clamav /var/log/clamav /var/lib/clamav -do - [ ! -d $i ] && mkdir -p $i && chown clamav:clamav $i -done +pidfile="`grep ^PidFile $CLAMAVCONF | awk '{print $2}'`" case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --oknodo -S -x $DAEMON - echo "$NAME" + echo "$NAME." ;; stop) echo -n "Stopping $DESC: " - if [ -n "$PID" ]; then - kill -15 -"$PID" - sleep 1 - if kill -0 "$PID" 2>/dev/null; then - echo -n "Waiting . " - cnt=0 - while kill -0 "$PID" 2>/dev/null; do - cnt=`expr "$cnt" + 1` - if [ "$cnt" -gt 60 ]; then - echo -n " Failed.. " - kill -9 -"$PID" - break - fi - sleep 2 - echo -n ". " - done - fi - else - start-stop-daemon -o -K -q -p $THEPIDFILE - fi - echo "$NAME" + start-stop-daemon -K -p $pidfile ;; restart|force-reload) |