loadconfig ctdb
loadconfig samba
+detect_init_style
+
+case $CTDB_INIT_STYLE in
+ suse)
+ CTDB_SERVICE_SMB="smb"
+ CTDB_SERVICE_NMB="nmb"
+ CTDB_SERVICE_WINBIND="winbind"
+ ;;
+ ubuntu)
+ CTDB_SERVICE_SMB="samba"
+ CTDB_SERVICE_NMB=""
+ CTDB_SERVICE_WINBIND="winbind"
+ ;;
+ redhat)
+ CTDB_SERVICE_SMB="smb"
+ CTDB_SERVICE_NMB=""
+ CTDB_SERVICE_WINBIND="winbind"
+ ;;
+ *)
+ # should not happen, but for now use redhat style as default:
+ CTDB_SERVICE_SMB="smb"
+ CTDB_SERVICE_NMB=""
+ CTDB_SERVICE_WINBIND="winbind"
+ ;;
+esac
+
cmd="$1"
shift
/bin/mkdir -p $CTDB_BASE/state/samba
# make sure samba is not already started
- service smb 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
killall -q -9 smbd
}
+ killall -0 -q nmbd && {
+ sleep 1
+ # make absolutely sure samba is dead
+ killall -q -9 nmbd
+ }
+
# restart the winbind service
check_ctdb_manages_winbind
[ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
- 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 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 smb start
+ nice_service $CTDB_SERVICE_NMB start
+ nice_service $CTDB_SERVICE_SMB start
;;
takeip)
shutdown)
# shutdown Samba when ctdb goes down
- service smb stop
+ service $CTDB_SERVICE_SMB stop
+ service $CTDB_SERVICE_NMB stop
# stop the winbind service
check_ctdb_manages_winbind
[ "$CTDB_MANAGES_WINBIND" = "yes" ] && {
- service winbind stop
+ service $CTDB_SERVICE_WINBIND stop
}
;;