Eventscripts: Work around 50.samba autostop failure
authorMartin Schwenke <martin@meltin.net>
Fri, 14 Oct 2011 06:29:35 +0000 (17:29 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 17 Oct 2011 04:27:44 +0000 (15:27 +1100)
This hack is shameful but the eventscript really needs to be split to
avoid this type of rubbish - 1 service per eventscript!

There are a few ways of hacking the conditions and this doesn't seem
much worse than any of the others...

This works... but on autostart will still restart the service that
isn't being autostarted.  That's a separate bug.

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/50.samba
config/functions

index 03bed85082c451cf9f38d58f02b76575b91d6090..55ddf32ae64362c9cdde898d71286489bb09bbda 100755 (executable)
@@ -93,14 +93,14 @@ start_samba() {
 
 stop_samba() {
        # shutdown Samba when ctdb goes down
-       [ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
+       [ "$CTDB_AUTOSTOPPING" != "winbind" -a "$CTDB_MANAGES_SAMBA" = "yes" -o "$CTDB_AUTOSTOPPING" = "samba" ] && {
                service "$CTDB_SERVICE_SMB" stop
                service "$CTDB_SERVICE_NMB" stop
        }
 
        # stop the winbind service
        check_ctdb_manages_winbind
-       [ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
+       [ "$CTDB_AUTOSTOPPING" != "samba" -a "$CTDB_MANAGES_WINBIND" = "yes"  -o "$CTDB_AUTOSTOPPING" = "winbind" ] && {
                service "$CTDB_SERVICE_WINBIND" stop
        }
 
index 8d2e48c2329d6bb757ae0065a853b95068527d06..e5924c6406e4e6c7bcde45f9e2de3fdeaa7be026 100755 (executable)
@@ -857,6 +857,7 @@ ctdb_start_stop_service ()
     else
        if [ -e "$_active" ] ; then
            echo "Stopping service $_service_name"
+           CTDB_AUTOSTOPPING="$_service_name"
            ctdb_service_stop || exit $?
            rm -f "$_active"
            exit 0