diff options
-rwxr-xr-x | ctdb/config/events.d/40.vsftpd | 2 | ||||
-rwxr-xr-x | ctdb/config/events.d/41.httpd | 1 | ||||
-rwxr-xr-x | ctdb/config/functions | 46 |
3 files changed, 36 insertions, 13 deletions
diff --git a/ctdb/config/events.d/40.vsftpd b/ctdb/config/events.d/40.vsftpd index 8ce2066348..d97dbe9394 100755 --- a/ctdb/config/events.d/40.vsftpd +++ b/ctdb/config/events.d/40.vsftpd @@ -14,7 +14,7 @@ service_stop () { service $service_name stop > /dev/null 2>&1 } -service_reconfigure="service $service_name restart" + service_fail_limit=2 service_tcp_ports=21 diff --git a/ctdb/config/events.d/41.httpd b/ctdb/config/events.d/41.httpd index 1115ba4c2c..87fcdd67ac 100755 --- a/ctdb/config/events.d/41.httpd +++ b/ctdb/config/events.d/41.httpd @@ -37,7 +37,6 @@ service_stop () service $service_name stop killall -q -9 $service_name || true } -service_reconfigure="service $service_name restart" loadconfig diff --git a/ctdb/config/functions b/ctdb/config/functions index 308781d203..6c9b6caca4 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -639,35 +639,59 @@ ctdb_setstatus () esac } +################################################################## +# Reconfigure a service on demand + +_ctdb_service_reconfigure_common () +{ + _d="$ctdb_status_dir/${1:-${service_name}}" + mkdir -p "$_d" + _ctdb_service_reconfigure_flag="$_d/reconfigure" +} + ctdb_service_needs_reconfigure () { - [ -e "$ctdb_status_dir/$service_name/reconfigure" ] + _ctdb_service_reconfigure_common "$@" + [ -e "$_ctdb_service_reconfigure_flag" ] } ctdb_service_set_reconfigure () { - d="$ctdb_status_dir/$service_name" - mkdir -p "$d" - >"$d/reconfigure" + _ctdb_service_reconfigure_common "$@" + >"$_ctdb_service_reconfigure_flag" } ctdb_service_unset_reconfigure () { - rm -f "$ctdb_status_dir/$service_name/reconfigure" + _ctdb_service_reconfigure_common "$@" + rm -f "$_ctdb_service_reconfigure_flag" } ctdb_service_reconfigure () { echo "Reconfiguring service \"$service_name\"..." - if [ -n "$service_reconfigure" ] ; then - eval $service_reconfigure - else - service "$service_name" restart + ctdb_service_unset_reconfigure "$@" + service_reconfigure "$@" || return $? + ctdb_counter_init "$@" +} + +# Default service_reconfigure() function. +service_reconfigure () +{ + service "${1:-$service_name}" restart +} + +ctdb_service_check_reconfigure () +{ + if ctdb_service_needs_reconfigure "$@" ; then + ctdb_service_reconfigure "$@" + exit 0 fi - ctdb_service_unset_reconfigure - ctdb_counter_init } +################################################################## +# Does CTDB manage this service? - and associated auto-start/stop + ctdb_compat_managed_service () { if [ "$1" = "yes" -a "$2" = "$_service_name" ] ; then |