1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/ctdb/config/events.d/31.clamd
Martin Schwenke 297b98d5b6 eventscripts: Each script should set CTDB_BASE if it is not set
This makes it easier to run the scripts externally.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 740ea8ea5084149c8b552a01ee1c98c558b12384)
2013-01-08 15:18:46 +11:00

53 lines
782 B
Bash
Executable File

#!/bin/sh
# event script to manage clamd in a cluster environment
[ -n "$CTDB_BASE" ] || \
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
. $CTDB_BASE/functions
detect_init_style
case $CTDB_INIT_STYLE in
redhat)
service_name="clamd"
service_config="clamd"
;;
*)
service_name="clamav"
service_config="clamav"
;;
esac
service_start ()
{
service $service_name stop > /dev/null 2>&1
service $service_name start
}
loadconfig
ctdb_start_stop_service
is_ctdb_managed_service || exit 0
case "$1" in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
monitor)
ctdb_check_unix_socket ${CTDB_CLAMD_SOCKET} || exit $?
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0