events 50.samba: fix control of nmbd without separate nmb service script.
authorMichael Adam <obnox@samba.org>
Mon, 19 Jan 2009 20:22:58 +0000 (21:22 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 19 Jan 2009 20:22:58 +0000 (21:22 +0100)
protect all potentially empty $CTDB_SERVICE_* script names

Michael

config/events.d/50.samba

index add77985539efc9712ac42c1c76058609cd3aa16..58df1dc6be134ccedf139796304543ce9444cdb7 100755 (executable)
@@ -144,8 +144,8 @@ case $cmd in
        /bin/mkdir -p $CTDB_BASE/state/samba
 
        # make sure samba is not already started
-       service $CTDB_SERVICE_SMB stop > /dev/null 2>&1
-       service $CTDB_SERVICE_NMB stop > /dev/null 2>&1
+       service "$CTDB_SERVICE_SMB" stop > /dev/null 2>&1
+       service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
        killall -0 -q smbd && {
            sleep 1
            # make absolutely sure samba is dead
@@ -161,20 +161,20 @@ case $cmd in
        # restart the winbind service
        check_ctdb_manages_winbind
        [ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
-               service $CTDB_SERVICE_WINBIND stop > /dev/null 2>&1
+               service "$CTDB_SERVICE_WINBIND" stop > /dev/null 2>&1
                killall -0 -q winbindd && {
                    sleep 1
                    # make absolutely sure winbindd is dead
                    killall -q -9 winbindd
                }
-               service $CTDB_SERVICE_WINBIND start
+               service "$CTDB_SERVICE_WINBIND" start
        }
 
        # start Samba service. Start it reniced, as under very heavy load 
        # the number of smbd processes will mean that it leaves few cycles for
        # anything else
-       nice_service $CTDB_SERVICE_NMB start
-       nice_service $CTDB_SERVICE_SMB start
+       nice_service "$CTDB_SERVICE_NMB" start
+       nice_service "$CTDB_SERVICE_SMB" start
        ;;
        
      takeip)
@@ -192,13 +192,13 @@ case $cmd in
 
      shutdown)
        # shutdown Samba when ctdb goes down
-       service $CTDB_SERVICE_SMB stop
-       service $CTDB_SERVICE_NMB stop
+       service "$CTDB_SERVICE_SMB" stop
+       service "$CTDB_SERVICE_NMB" stop
 
        # stop the winbind service
        check_ctdb_manages_winbind
        [ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
-               service $CTDB_SERVICE_WINBIND stop
+               service "$CTDB_SERVICE_WINBIND" stop
        }
        ;;