1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

add an easy way to setup ctdb to start/stop samba

(This used to be ctdb commit b0d9f427d83aff5b9a5c54b7b7c9d45d418e2352)
This commit is contained in:
Andrew Tridgell 2007-06-02 18:51:05 +10:00
parent 50fdcd31f9
commit 2f5af51c53
5 changed files with 44 additions and 16 deletions

View File

@ -119,13 +119,17 @@ case "$1" in
restart
;;
status)
rhstatus
status
;;
condrestart)
ctdb status > /dev/null && restart || :
;;
cron)
# used from cron to auto-restart ctdb
ctdb status > /dev/null || start
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
echo $"Usage: $0 {start|stop|restart|status|cron|condrestart}"
exit 1
esac

View File

@ -5,6 +5,20 @@
# there is no default
# CTDB_RECOVERY_LOCK="/some/place/on/shared/storage"
# should ctdb do IP takeover? If it should, then specify a file
# containing the list of public IP addresses that ctdb will manage
# Note that these IPs must be different from those in $NODES above
# there is no default
# PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
# when doing IP takeover you also must specify what network interface
# to use for the public addresses
# there is no default
# PUBLIC_INTERFACE=eth0
# should ctdb manage starting/stopping the Samba service for you?
# default is to not manage Samba
# CTDB_MANAGES_SAMBA=yes
# the NODES file must be specified or ctdb won't start
# it should contain a list of IPs that ctdb will use
@ -29,17 +43,6 @@
# defaults to tcp
# TRANSPORT="tcp"
# should ctdb do IP takeover? If it should, then specify a file
# containing the list of public IP addresses that ctdb will manage
# Note that these IPs must be different from those in $NODES above
# there is no default
# PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
# when doing IP takeover you also must specify what network interface
# to use for the public addresses
# there is no default
# PUBLIC_INTERFACE=eth0
# where to log messages
# the default is /var/log/log.ctdb
# LOGFILE=/var/log/log.ctdb

View File

@ -33,8 +33,8 @@ case $cmd in
# restart NFS to ensure that all TCP connections to the released ip
# are closed
[ -f /etc/ctdb/state/nfs/restart ] && {
( /sbin/service nfs status > /dev/null 2>&1 &&
/sbin/service nfs restart > /dev/null 2>&1 ) &
( service nfs status > /dev/null 2>&1 &&
service nfs restart > /dev/null 2>&1 ) &
} > /dev/null 2>&1
/bin/rm -f /etc/ctdb/state/nfs/restart
;;

View File

@ -9,8 +9,14 @@ PATH=/bin:/usr/bin:$PATH
cmd="$1"
shift
[ "$CTDB_MANAGES_SAMBA" = "yes" ] || exit 0
case $cmd in
startup)
# start Samba service
service smb start
service winbind start
# wait for the Samba tcp ports to become available
smb_ports=`testparm -stv 2> /dev/null | egrep '\s*smb ports =' | cut -d= -f2`
ctdb_wait_tcp_ports "Samba" $smb_ports
@ -35,7 +41,8 @@ case $cmd in
shutdown)
# shutdown Samba when ctdb goes down
killall -q smbd nmbd winbindd
service smb stop
service winbind stop
;;
esac

View File

@ -1,6 +1,20 @@
# utility functions for ctdb event scripts
######################################################
# simulate /sbin/service on platforms that don't have it
service() {
service_name="$1"
op="$2"
if [ -x /sbin/service ]; then
/sbin/service "$service_name" "$op"
elif [ -x /etc/init.d/$service_name ]; then
/etc/init.d/$service_name "$op"
elif [ -x /etc/rc.d/init.d/$service_name ]; then
/etc/init.d/$service_name "$op"
fi
}
######################################################
# wait for a set of tcp ports
# usage: ctdb_wait_tcp_ports SERICE_NAME <ports...>