-
Notifications
You must be signed in to change notification settings - Fork 0
/
clamd.init
70 lines (62 loc) · 1.26 KB
/
clamd.init
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# Startup script for the Clam AntiVirus Daemon
#
# chkconfig: 2345 61 39
# description: Clam AntiVirus Daemon is a TCP/IP or socket protocol \
# server.
# processname: clamd
# pidfile: /var/run/clamav/clamd.pid
# config: /etc/clamd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
[ -x /usr/sbin/clamd ] || exit 0
start(){
echo -n "Starting Clam AntiVirus Daemon: "
daemon clamd
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
return $RETVAL
}
stop() {
echo -n "Stopping Clam AntiVirus Daemon: "
killproc clamd
rm -f /var/clamav/clamd.socket
rm -f /var/run/clamav/clamav.pid
RETVAL=$?
echo
### heres the fix... we gotta remove the stale files on restart
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status clamd
RETVAL=$?
;;
restart|reload)
restart
;;
condrestart)
[ -e /var/lock/subsys/clamd ] && $0 restart
RETVAL=$?
;;
*)
echo "Usage: clamd {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit $RETVAL