]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
run smbstatus every 10 minutes to scrub databases
authorAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 17:15:08 +0000 (03:15 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 17 Jun 2007 17:15:08 +0000 (03:15 +1000)
(This used to be ctdb commit cd119cdb9a1a7e0545f1c33a2a156a3d3c5d7645)

ctdb/config/events.d/50.samba

index 7005fc8c9b06f1fa56de24f9dbbcbf648aba6530..8a36297e3d718b0feadf73d021e1f95632908886 100755 (executable)
@@ -11,6 +11,20 @@ shift
 
 [ "$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 @@ case $cmd in
        [ -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
        }