1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00
samba-mirror/ctdb/config/events/legacy/47.samba-dcerpcd.script
Stefan Metzmacher f1f68108cc ctdb/events: add 47.samba-dcerpcd.script
If someone wants to enable the witness service
samba-dcerpcd needs to be started as standalone service

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15577

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2024-02-13 20:02:31 +00:00

67 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# ctdb event script for SAMBA DCERPCD Services
[ -n "$CTDB_BASE" ] || \
CTDB_BASE=$(d=$(dirname "$0") && cd -P "$d" && dirname "$PWD")
. "${CTDB_BASE}/functions"
detect_init_style
case $CTDB_INIT_STYLE in
*)
# distributions don't have this yet,
# but assume samba-dcerpcd as service name
CTDB_SERVICE_SAMBA_DCERPCD=${CTDB_SERVICE_SAMBA_DCERPCD:-samba-dcerpcd}
;;
esac
load_script_options
service_start ()
{
# make sure samba-dcerpcd is not already started
service "$CTDB_SERVICE_SAMBA_DCERPCD" stop > /dev/null 2>&1
killall -0 -q samba-dcerpcd && {
sleep 1
# make absolutely sure samba-dcerpcd is dead
killall -q -9 samba-dcerpcd
}
# start Samba dcerpcd service. Start it reniced, as under very heavy load
# the number of smbd processes will mean that it leaves few cycles
# for anything else
nice_service "$CTDB_SERVICE_SAMBA_DCERPCD" start || die "Failed to start samba-dcerpcd"
}
service_stop ()
{
service "$CTDB_SERVICE_SAMBA_DCERPCD" stop
}
service_status ()
{
service "$CTDB_SERVICE_SAMBA_DCERPCD" status > /dev/null
test $? = 0 && return 0
service "$CTDB_SERVICE_SAMBA_DCERPCD" status
}
###########################
case "$1" in
startup)
service_start
;;
shutdown)
service_stop
;;
monitor)
service_status
;;
esac
exit 0