Eventscripts: 50.samba - only start/stop nmbd if $CTDB_SERVICE_NMB set.
authorMartin Schwenke <martin@meltin.net>
Fri, 27 May 2011 04:37:37 +0000 (14:37 +1000)
committerMartin Schwenke <martin@meltin.net>
Thu, 11 Aug 2011 00:46:57 +0000 (10:46 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/50.samba

index 25e7f7596c7dabaa5243640bb1d294896514ff59..1c6822714f590e2fea5174546b56a3e83e9afa4b 100755 (executable)
@@ -39,7 +39,9 @@ service_start ()
        if [ "$_service_name" = "samba" ] || \
            is_ctdb_managed_service "samba" ; then
                service "$CTDB_SERVICE_SMB" stop > /dev/null 2>&1
-               service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
+               if [ -n "$CTDB_SERVICE_NMB" ] ; then
+                   service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
+               fi
                killall -0 -q smbd && {
                    sleep 1
                    # make absolutely sure samba is dead
@@ -81,10 +83,12 @@ service_start ()
            is_ctdb_managed_service "samba" ; then
                net serverid wipe
 
-               nice_service "$CTDB_SERVICE_NMB" start || {
+               if [ -n "$CTDB_SERVICE_NMB" ] ; then
+                   nice_service "$CTDB_SERVICE_NMB" start || {
                        echo failed to start nmbd
                        exit 1
-               }
+                   }
+               fi
                nice_service "$CTDB_SERVICE_SMB" start || {
                        echo failed to start samba
                        exit 1
@@ -101,7 +105,9 @@ service_stop ()
        if [ "$_service_name" = "samba" ] || \
            is_ctdb_managed_service "samba" ; then
                service "$CTDB_SERVICE_SMB" stop
-               service "$CTDB_SERVICE_NMB" stop
+               if [ -n "$CTDB_SERVICE_NMB" ] ; then
+                   service "$CTDB_SERVICE_NMB" stop
+               fi
        fi
 
        # stop the winbind service