]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/packages/clamav
clamav: Move database directory to /var partition
[ipfire-2.x.git] / src / initscripts / packages / clamav
CommitLineData
f7ff12a3
MT
1#!/bin/sh
2# Begin $rc_base/init.d/clamav
3
4. /etc/sysconfig/rc
5. $rc_functions
6
7case "$1" in
8 start)
bfa65be8
AF
9 if [ $(basename $0) == "clamav" ]; then
10 boot_mesg "Starting Clamav Definition Updater..."
11 loadproc /usr/bin/freshclam -d -c 10
4558108c 12
bfa65be8 13 COUNTER=0
4558108c 14 while [ "$COUNTER" -lt "61" ]; do
aeefbca7
MT
15 [ -e "/var/lib/clamav/main.cvd" ] && \
16 [ -e "/var/lib/clamav/daily.cvd" ] || \
17 [ -e "/var/lib/clamav/daily.cld" ] && \
bfa65be8 18 break
4558108c 19 if [ "$COUNTER" -lt "1" ]; then
aeefbca7 20 boot_mesg -n "Downloading database"
4558108c
AF
21 else
22 boot_mesg -n "."
23 fi
24 sleep 15
bfa65be8
AF
25 COUNTER=$(($COUNTER + 1))
26 done
4558108c
AF
27 if [ "$COUNTER" -gt "0" ]; then
28 boot_mesg
29 fi
30 if [ "$COUNTER" -gt "60" ]; then
31 boot_mesg "Download takes longer than 15min check freshclam status!"
32 echo_failure;
33 exit 1;
34 fi
35
36 boot_mesg "Starting Clamav Daemon..."
bfa65be8
AF
37 loadproc /usr/sbin/clamd
38 else
39 boot_mesg "Starting Clamav in background..."
40 /etc/init.d/clamav start > /dev/tty12 < /dev/tty12 &
41 echo_ok;
42 exit 0;
43 fi
f7ff12a3
MT
44 ;;
45
46 stop)
47 boot_mesg "Stopping Clamav Definition Updater..."
48 killproc /usr/bin/freshclam
aeefbca7 49 rm -rf /var/lib/clamav/*.tmp
4558108c 50
f7ff12a3
MT
51 boot_mesg "Stopping Clamav Daemon..."
52 killproc /usr/sbin/clamd
53 ;;
54
55 restart)
56 $0 stop
57 sleep 1
58 $0 start
59 ;;
60
61 status)
62 statusproc /usr/sbin/clamd
63 statusproc /usr/bin/freshclam
64 ;;
65
66 *)
67 echo "Usage: $0 {start|stop|restart|status}"
68 exit 1
69 ;;
70esac
71
72# End $rc_base/init.d/clamav