Rev 548: run smbstatus every 10 minutes to scrub databases in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sun Jun 17 17:15:08 GMT 2007


------------------------------------------------------------
revno: 548
revision-id: tridge at samba.org-20070617171508-dshksshlnzdh2qfs
parent: tridge at samba.org-20070617171050-2zkpq4tu68qqryfo
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-06-18 03:15:08 +1000
message:
  run smbstatus every 10 minutes to scrub databases
modified:
  config/events.d/50.samba       samba-20070601105340-vlcvnp6euoj3zdwy-3
=== modified file 'config/events.d/50.samba'
--- a/config/events.d/50.samba	2007-06-17 17:10:50 +0000
+++ b/config/events.d/50.samba	2007-06-17 17:15:08 +0000
@@ -11,6 +11,20 @@
 
 [ "$CTDB_MANAGES_SAMBA" = "yes" ] || exit 0
 
+# set default samba cleanup period - in minutes
+[ -z "$SAMBA_CLEANUP_PERIOD" ] && {
+    SAMBA_CLEANUP_PERIOD=10
+}
+
+###########################
+# periodic cleanup function
+periodic_cleanup() {
+    # running smbstatus scrubs any dead entries from the connections
+    # and sessionid database
+    echo "`date` Running periodic cleanup of samba databases"
+    smbstatus -n > /dev/null 2>&1
+}
+
 case $cmd in 
      startup)
 	# create the state directory for samba
@@ -63,8 +77,9 @@
 	[ -f /etc/ctdb/state/samba/periodic_cleanup ] || {
 		touch /etc/ctdb/state/samba/periodic_cleanup
 	}
-	[ `/usr/bin/find /etc/ctdb/state/samba/periodic_cleanup -mmin +1 | wc -l` -eq 1 ] && {
+	[ `/usr/bin/find /etc/ctdb/state/samba/periodic_cleanup -mmin +$SAMBA_CLEANUP_PERIOD | wc -l` -eq 1 ] && {
 		# Cleanup the databases
+	    	periodic_cleanup
 		touch /etc/ctdb/state/samba/periodic_cleanup
 	}
 



More information about the samba-cvs mailing list