mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
ctdb-scripts: Move failure counters to the service state directory
Scripts that use these counters must call ctdb_setup_state_dir(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
e6aae12ba2
commit
bcadab7149
@ -8,6 +8,8 @@
|
||||
|
||||
loadconfig
|
||||
|
||||
ctdb_setup_state_dir "service" "reclock"
|
||||
|
||||
# If CTDB_RECOVERY_LOCK specifies a helper then exit because this
|
||||
# script can't do anything useful.
|
||||
case "$CTDB_RECOVERY_LOCK" in
|
||||
|
@ -23,6 +23,8 @@ suse|debian|*)
|
||||
;;
|
||||
esac
|
||||
|
||||
ctdb_setup_state_dir "service" "$service_name"
|
||||
|
||||
# RHEL5 sometimes use a SIGKILL to terminate httpd, which then leaks
|
||||
# semaphores. This is a hack to clean them up.
|
||||
cleanup_httpd_semaphore_leak() {
|
||||
|
@ -697,10 +697,21 @@ interface_monitor ()
|
||||
|
||||
########################################################
|
||||
# Simple counters
|
||||
_ctdb_counter_common () {
|
||||
_service_name="${1:-${service_name:-${script_name}}}"
|
||||
_counter_file="${CTDB_SCRIPT_VARDIR}/failcount/${_service_name}"
|
||||
mkdir -p "${_counter_file%/*}" # dirname
|
||||
_ctdb_counter_common ()
|
||||
{
|
||||
[ $# -le 1 ] || die "usage: _ctdb_counter_common [name]"
|
||||
|
||||
if [ $# -eq 1 ] ; then
|
||||
_counter_name="${1}.failcount"
|
||||
else
|
||||
_counter_name="failcount"
|
||||
fi
|
||||
|
||||
if [ -z "$script_state_dir" ] ; then
|
||||
die "ctdb_counter_* functions need ctdb_setup_state_dir()"
|
||||
fi
|
||||
|
||||
_counter_file="${script_state_dir}/${_counter_name}"
|
||||
}
|
||||
# Some code passes an argument
|
||||
# shellcheck disable=SC2120
|
||||
|
Loading…
x
Reference in New Issue
Block a user