+ killall -0 -q nmbd && {
+ sleep 1
+ # make absolutely sure samba is dead
+ killall -q -9 nmbd
+ }
+ }
+
+ # make sure winbind is not already started
+ check_ctdb_manages_winbind
+ [ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
+ 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
+ }
+
+ }
+
+ # start the winbind service
+ [ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
+ 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
+ [ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
+ /usr/bin/net serverid wipe
+
+ nice_service "$CTDB_SERVICE_NMB" start
+ nice_service "$CTDB_SERVICE_SMB" start
+ }
+ return 0
+}
+
+stop_samba() {
+ # shutdown Samba when ctdb goes down
+ [ "$CTDB_MANAGES_SAMBA" = "yes" ] && {
+ 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
+ }
+
+ return 0
+}