]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.init
- fixed Group
[packages/clamav.git] / clamav.init
1 #!/bin/sh
2 #
3 # clamd         clamd (antyvirus daemon)
4 #
5 # chkconfig:    345 60 40
6 #
7 # description:  Clam Antivirus daemon
8 #
9 # processname:  clamd
10 # pidfile:      /var/run/clamav/clamd.pid
11 #
12 # $Id$
13
14 # Source function library
15 . /etc/rc.d/init.d/functions
16
17 # Get service config
18 [ -f /etc/sysconfig/clamd ] && . /etc/sysconfig/clamd
19
20 start() {
21         # Check if the service is already running?
22         if [ -f /var/lock/subsys/clamd ]; then
23                 msg_already_running "Clam Antivirus daemon"
24                 return
25         fi
26
27         msg_starting "Clam Antivirus daemon"
28         daemon --pidfile /var/run/clamav/clamd.pid /usr/sbin/clamd
29         RETVAL=$?
30         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
31 }
32
33 stop() {
34         if [ ! -f /var/lock/subsys/clamd ]; then
35                 msg_not_running "Clam Antivirus daemon"
36                 return
37         fi
38
39         msg_stopping "Clam Antivirus daemon"
40         killproc --pidfile /var/run/clamav/clamd.pid clamd
41         rm -f /var/lock/subsys/clamd /var/run/clamav/clamd.pid >/dev/null 2>&1
42 }
43
44 reload() {
45         if [ -f /var/lock/subsys/clamd ]; then
46                 msg_reloading "Clam Antivirus daemon"
47                 killproc clamd -HUP
48                 RETVAL=$?
49         else
50                 msg_not_running "Clam Antivirus daemon"
51                 RETVAL=7
52         fi
53 }
54
55 condrestart() {
56         if [ -f /var/lock/subsys/clamd ]; then
57                 stop
58                 start
59         else
60                 msg_not_running "Clam Antivirus daemon"
61                 RETVAL=$1
62         fi
63 }
64
65 RETVAL=0
66 # See how we were called.
67 case "$1" in
68   start)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart)
75         stop
76         start
77         ;;
78   try-restart)
79         condrestart 0
80         ;;
81   reload|force-reload)
82         reload
83         ;;
84   status)
85         status clamd
86         exit $?
87         ;;
88   *)
89         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
90         exit 3
91 esac
92
93 exit $RETVAL
This page took 0.098424 seconds and 3 git commands to generate.