ctdb-scripts: Move event scripts to events/legacy/ directory
[kai/samba-autobuild/.git] / ctdb / config / events / legacy / 31.clamd.script
1 #!/bin/sh
2 # event script to manage clamd in a cluster environment
3
4 [ -n "$CTDB_BASE" ] || \
5     CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
6
7 . "${CTDB_BASE}/functions"
8
9 detect_init_style
10
11 case $CTDB_INIT_STYLE in
12 redhat)
13         service_name="clamd"
14         ;;
15 *)
16         service_name="clamav"
17         ;;
18 esac
19
20 load_script_options
21
22 [ "$CTDB_MANAGES_CLAMD" = "yes" ] || exit 0
23
24 case "$1" in
25 startup)
26         service "$service_name" stop > /dev/null 2>&1
27         service "$service_name" start || exit $?
28         ;;
29
30 shutdown)
31         service "$service_name"_stop
32         ;;
33
34 monitor)
35         ctdb_check_unix_socket "$CTDB_CLAMD_SOCKET" || exit $?
36         ;;
37 esac
38
39 exit 0