summaryrefslogtreecommitdiff
path: root/packages/clamav/files/clamav-daemon.init
blob: bab7a184d7ecd44fc3dd0e4ed4d7c3bb6ddad91e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/clamd
NAME="clamd"
DESC="ClamAV daemon"
CLAMAVCONF=/etc/clamd.conf

set -e

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
pidfile="`grep ^PidFile $CLAMAVCONF | awk '{print $2}'`"

case "$1" in
  start)
    echo -n "Starting $DESC: "
    start-stop-daemon --oknodo -S -x $DAEMON
    echo "$NAME."
    ;;

  stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon -K -p $pidfile
    ;;

    restart|force-reload)
    $0 stop
    $0 start
    ;;

    *)
    echo "Usage: $0 {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0