summaryrefslogtreecommitdiffstats
path: root/ctdb/config/events.d/31.clamd
blob: 11238b7465a3871a42e6c5332b490984c439a01b (plain)
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
#!/bin/sh
# event script to manage clamd in a cluster environment

. $CTDB_BASE/functions
loadconfig ctdb

detect_init_style

case $CTDB_INIT_STYLE in
	redhat)
		CTDB_SERVICE_CLAMD="clamd"
		CTDB_CONFIG_CLAMD="clamd"
		;;
	suse)
		CTDB_SERVICE_CLAMD="clamav"
		CTDB_CONFIG_CLAMD="clamav"
		;;
	ubuntu)
		CTDB_SERVICE_CLAMD="clamav"
		CTDB_CONFIG_CLAMD="clamav"
		;;
	*)
		# should not happen.
		# for now use red hat style as default
		CTDB_SERVICE_CLAMD="clamd"
		CTDB_CONFIG_CLAMD="clamd"
		;;
esac

loadconfig "${CTDB_CONFIG_CLAMD}"

[ "$CTDB_MANAGES_CLAMD" = "yes" ] || exit 0

cmd="$1"
shift

case $cmd in 
     startup)
        service "${CTDB_SERVICE_CLAMD}" stop > /dev/null 2>&1
        service "${CTDB_SERVICE_CLAMD}" start
        ;;

     shutdown)
        service "${CTDB_SERVICE_CLAMD}" stop
        ;;

     monitor)
        ctdb_check_unix_socket "clamd" ${CTDB_CLAMD_SOCKET}
        ;;
esac

exit 0