[SCM] CTDB repository - branch 1.2 updated - ctdb-1.9.1-241-g92bcf1c
Ronnie Sahlberg
sahlberg at samba.org
Wed Nov 17 18:31:45 MST 2010
The branch, 1.2 has been updated
via 92bcf1c475d8497e08a0babf7a7b3434dade7208 (commit)
from d0b790de08b9c9226ac9848b434a051d99a41dd8 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.2
- Log -----------------------------------------------------------------
commit 92bcf1c475d8497e08a0babf7a7b3434dade7208
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Nov 18 11:04:52 2010 +1100
50.samba eventscript should stop/start services when they become (un)managed.
When the value of $CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND (or
corresponding changes are made to $CTDB_MANAGED_VERSIONS), the
associated service should be started or stopped as necessary.
This add calls to ctdb_start_stop_service() to manage
starting/stopping samba and winbind.
An associated cleanup is made to the initial checks that one of
$CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND is set, replacing them
with calls to is_ctdb_managed_service().
To handle the winbind cases ctdb_start_stop_service() and
is_ctdb_managed_service() are updated to take an optional service name
parameter.
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/50.samba | 11 +++++++++--
config/functions | 14 +++++++++-----
2 files changed, 18 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/50.samba b/config/events.d/50.samba
index 047f9e0..5338c92 100755
--- a/config/events.d/50.samba
+++ b/config/events.d/50.samba
@@ -30,8 +30,6 @@ service_stop="stop_samba"
loadconfig
-[ "$CTDB_MANAGES_SAMBA" = "yes" ] || [ "$CTDB_MANAGES_WINBIND" = "yes" ] || exit 0
-
start_samba() {
# create the state directory for samba
/bin/mkdir -p $CTDB_VARDIR/state/samba
@@ -203,6 +201,15 @@ periodic_cleanup() {
smbstatus -np > /dev/null 2>&1 &
}
+###########################
+
+ctdb_start_stop_service
+ctdb_start_stop_service "windbind"
+
+is_ctdb_managed_service || is_ctdb_managed_service "winbind" || exit 0
+
+###########################
+
case "$1" in
startup)
ctdb_service_start
diff --git a/config/functions b/config/functions
index 4acfc4f..a7e3e53 100755
--- a/config/functions
+++ b/config/functions
@@ -662,6 +662,8 @@ ctdb_compat_managed_service ()
is_ctdb_managed_service ()
{
+ _service_name="${1:-${service_name}}"
+
t=" $CTDB_MANAGED_SERVICES "
ctdb_compat_managed_service "$CTDB_MANAGES_VSFTPD" "vsftpd"
@@ -673,17 +675,19 @@ is_ctdb_managed_service ()
ctdb_compat_managed_service "$CTDB_MANAGES_CLAMD" "clamd"
ctdb_compat_managed_service "$CTDB_MANAGES_NFS" "nfs"
- # Returns 0 if "<space>$service_name<space>" appears in $t
- [ "${t#* ${service_name} }" != "${t}" ]
+ # Returns 0 if "<space>$_service_name<space>" appears in $t
+ [ "${t#* ${_service_name} }" != "${t}" ]
}
ctdb_start_stop_service ()
{
- _active="$ctdb_active_dir/$service_name"
+ _service_name="${1:-${service_name}}"
+
+ _active="$ctdb_active_dir/$_service_name"
if is_ctdb_managed_service ; then
if ! [ -e "$_active" ] ; then
- echo "Starting service $service_name"
+ echo "Starting service $_service_name"
ctdb_service_start || exit $?
mkdir -p "$ctdb_active_dir"
touch "$_active"
@@ -691,7 +695,7 @@ ctdb_start_stop_service ()
fi
elif ! is_ctdb_managed_service ; then
if [ -e "$_active" ] ; then
- echo "Stopping service $service_name"
+ echo "Stopping service $_service_name"
ctdb_service_stop || exit $?
rm -f "$_active"
fi
--
CTDB repository
More information about the samba-cvs
mailing list