Rev 434: add an easy way to setup ctdb to start/stop samba in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sat Jun 2 08:51:06 GMT 2007


------------------------------------------------------------
revno: 434
revision-id: tridge at samba.org-20070602085105-lqk6s1tvj4fgn26b
parent: tridge at samba.org-20070602080816-xkcs5l60md7prakr
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-06-02 18:51:05 +1000
message:
  add an easy way to setup ctdb to start/stop samba
modified:
  packaging/ctdb.init            ctdb.init-20070527204758-biuh7znabuwan3zn-6
  tools/ctdb.sysconfig           ctdb.sysconfig-20070527204758-biuh7znabuwan3zn-7
  tools/events.d/nfs             nfs-20070601141008-hy3h4qgbk1jd2jci-1
  tools/events.d/samba           samba-20070601105340-vlcvnp6euoj3zdwy-3
  tools/functions                functions-20070601105405-gajwirydr5a9zd6x-1
=== modified file 'packaging/ctdb.init'
--- a/packaging/ctdb.init	2007-06-02 01:36:42 +0000
+++ b/packaging/ctdb.init	2007-06-02 08:51:05 +0000
@@ -119,13 +119,17 @@
   	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
 

=== modified file 'tools/ctdb.sysconfig'
--- a/tools/ctdb.sysconfig	2007-06-02 06:33:17 +0000
+++ b/tools/ctdb.sysconfig	2007-06-02 08:51:05 +0000
@@ -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

=== modified file 'tools/events.d/nfs'
--- a/tools/events.d/nfs	2007-06-02 06:44:15 +0000
+++ b/tools/events.d/nfs	2007-06-02 08:51:05 +0000
@@ -33,8 +33,8 @@
         # 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
 	;;

=== modified file 'tools/events.d/samba'
--- a/tools/events.d/samba	2007-06-01 14:10:22 +0000
+++ b/tools/events.d/samba	2007-06-02 08:51:05 +0000
@@ -9,8 +9,14 @@
 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 @@
 
      shutdown)
 	# shutdown Samba when ctdb goes down
-	killall -q smbd nmbd winbindd
+	service smb stop
+	service winbind stop
 	;;
 esac
 

=== modified file 'tools/functions'
--- a/tools/functions	2007-06-01 13:25:33 +0000
+++ b/tools/functions	2007-06-02 08:51:05 +0000
@@ -2,6 +2,20 @@
 
 
 ######################################################
+# 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...>
 ######################################################



More information about the samba-cvs mailing list