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/legacy/49.winbind.script
Martin Schwenke e081cafc9c ctdb-scripts: Drop event script CTDB_MANAGED_<service> variables
Enable required event scripts to manage services.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-07-11 11:48:39 +02:00

56 lines
902 B
Bash
Executable File

#!/bin/sh
# ctdb event script for winbind
[ -n "$CTDB_BASE" ] || \
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
. "${CTDB_BASE}/functions"
CTDB_SERVICE_WINBIND=${CTDB_SERVICE_WINBIND:-winbind}
# service_name is used by various functions
# shellcheck disable=SC2034
service_name="winbind"
load_script_options
service_start ()
{
service "$CTDB_SERVICE_WINBIND" stop >/dev/null 2>&1
killall -0 -q winbindd && {
sleep 1
# make absolutely sure winbindd is dead
killall -q -9 winbindd
}
service "$CTDB_SERVICE_WINBIND" start || \
die "Failed to start winbind"
}
service_stop ()
{
service "$CTDB_SERVICE_WINBIND" stop
}
###########################
case "$1" in
startup)
service_start
;;
shutdown)
service_stop
;;
monitor)
if ! out=$(wbinfo -p 2>&1) ; then
echo "ERROR: wbinfo -p returned error"
echo "$out"
exit 1
fi
;;
esac
exit 0