1 |
slords |
1.1 |
#!/bin/sh |
2 |
|
|
# |
3 |
|
|
# Startup script for the Clam AntiVirus Daemon |
4 |
|
|
# |
5 |
|
|
# chkconfig: 2345 61 39 |
6 |
|
|
# description: Clam AntiVirus Daemon is a TCP/IP or socket protocol \ |
7 |
|
|
# server. |
8 |
|
|
# processname: clamd |
9 |
|
|
# pidfile: /var/run/clamav/clamd.pid |
10 |
|
|
# config: /etc/clamav.conf |
11 |
|
|
|
12 |
|
|
# Source function library. |
13 |
|
|
. /etc/rc.d/init.d/functions |
14 |
|
|
|
15 |
|
|
# Source networking configuration. |
16 |
|
|
. /etc/sysconfig/network |
17 |
|
|
|
18 |
|
|
[ -x /usr/sbin/clamd ] || exit 0 |
19 |
|
|
|
20 |
|
|
start(){ |
21 |
|
|
echo -n "Starting Clam AntiVirus Daemon: " |
22 |
|
|
daemon clamd |
23 |
|
|
RETVAL=$? |
24 |
|
|
echo |
25 |
|
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd |
26 |
|
|
return $RETVAL |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
stop() { |
30 |
|
|
echo -n "Stopping Clam AntiVirus Daemon: " |
31 |
|
|
killproc clamd |
32 |
|
|
rm -f /var/clamav/clamd.socket |
33 |
|
|
rm -f /var/run/clamav/clamav.pid |
34 |
|
|
RETVAL=$? |
35 |
|
|
echo |
36 |
|
|
### heres the fix... we gotta remove the stale files on restart |
37 |
|
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd |
38 |
|
|
return $RETVAL |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
restart() { |
42 |
|
|
stop |
43 |
|
|
start |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
# See how we were called. |
47 |
|
|
case "$1" in |
48 |
|
|
start) |
49 |
|
|
start |
50 |
|
|
;; |
51 |
|
|
stop) |
52 |
|
|
stop |
53 |
|
|
;; |
54 |
|
|
status) |
55 |
|
|
status clamd |
56 |
|
|
RETVAL=$? |
57 |
|
|
;; |
58 |
|
|
restart|reload) |
59 |
|
|
restart |
60 |
|
|
;; |
61 |
|
|
condrestart) |
62 |
|
|
[ -e /var/lock/subsys/clamd ] && $0 restart |
63 |
|
|
RETVAL=$? |
64 |
|
|
;; |
65 |
|
|
*) |
66 |
|
|
echo "Usage: clamd {start|stop|status|restart|reload|condrestart}" |
67 |
|
|
exit 1 |
68 |
|
|
esac |
69 |
|
|
|
70 |
|
|
exit $RETVAL |
71 |
|
|
|