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
# 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
# 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
# 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
;;
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
shutdown)
# shutdown Samba when ctdb goes down
- killall -q smbd nmbd winbindd
+ service smb stop
+ service winbind stop
;;
esac
# 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...>