updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / clamav-devel / clamav
blob8e9c6afa936ce5b0991752c9762286f6e8c6de29
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 # source application-specific settings
7 [ -f /etc/conf.d/clamav ] && . /etc/conf.d/clamav
9 PID_FC=`pidof -o %PPID /usr/bin/freshclam`
10 PID_CD=`pidof -o %PPID /usr/sbin/clamd`
12 case "$1" in
13 start)
14 # if clamd isn't started first, notifyclamd fails at times
15 if [ "$START_CLAMD" == "yes" ]; then
16 stat_busy "Starting ClamD"
17 [ -z "$PID_CD" ] && /usr/sbin/clamd
18 if [ $? -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon clamav
22 stat_done
26 # give clamd enough time to start
27 sleep 1
29 if [ "$START_FRESHCLAM" == "yes" ]; then
30 stat_busy "Starting FreshClam"
31 [ -z "$PID_FC" ] && /usr/bin/freshclam -p /var/run/clamav/freshclam.pid -d $FRESHCLAM_OPTS
32 if [ $? -gt 0 ]; then
33 stat_fail
34 else
35 add_daemon clamav
36 stat_done
40 stop)
41 if [ "$START_CLAMD" == "yes" ]; then
42 stat_busy "Stopping ClamD"
43 [ -n "$PID_CD" ] && kill $PID_CD &> /dev/null
44 if [ $? -gt 0 ]; then
45 stat_fail
46 else
47 rm_daemon clamav
48 stat_done
52 if [ "$START_FRESHCLAM" == "yes" ]; then
53 stat_busy "Stopping FreshClam"
54 [ -n "$PID_FC" ] && kill $PID_FC &> /dev/null
55 if [ $? -gt 0 ]; then
56 stat_fail
57 else
58 rm_daemon clamav
59 stat_done
63 restart)
64 $0 stop
65 # will not start if not fully stopped, so sleep
66 sleep 2
67 $0 start
70 echo "usage: $0 {start|stop|restart}"
71 esac
72 exit 0