#!/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" loadconfig 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 } ########################### is_ctdb_managed_service || exit 0 ########################### 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