1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/ctdb/config/events.d/49.winbind
Martin Schwenke b208ae73d1 ctdb-scripts: Avoid shellcheck warning SC2154 (unassigned variables)
SC2154: VAR is referenced but not assigned.

Change ctdb_setup_service_state_dir(), ctdb_get_pnn() and
ctdb_get_ip_address() to print the value so it can be assigned to a
variable.  The performance gain from avoiding the sub-shells when
calling these functions is close to zero.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-07-21 02:24:26 +02:00

58 lines
919 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"
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
}
###########################
ctdb_start_stop_service
is_ctdb_managed_service || exit 0
###########################
case "$1" in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
monitor)
ctdb_check_command wbinfo -p
;;
esac
exit 0