From d2ada57f60e207ed6c7f3f8636422e56f894e054 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 18 Jun 2007 02:34:29 +1000 Subject: [PATCH] add a mechanism to the samba event script to do periodic cleanup of the databases once every 60 minutes (This used to be ctdb commit 8762e08284343bf68bfed90838483e5d53db24ce) --- ctdb/config/events.d/50.samba | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba index 0c48252a763..d011519c8f0 100755 --- a/ctdb/config/events.d/50.samba +++ b/ctdb/config/events.d/50.samba @@ -13,6 +13,9 @@ shift case $cmd in startup) + # create the state directory for samba + /bin/mkdir -p /etc/ctdb/state/samba + # wait for all shared directories to become available smb_dirs=`testparm -s 2> /dev/null | egrep '^\s*path = ' | cut -d= -f2` ctdb_wait_directories "Samba" $smb_dirs @@ -52,6 +55,16 @@ case $cmd in ;; monitor) + # Create a dummy file to track when we need to do periodic cleanup + # of samba databases + [ -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 ] && { + # Cleanup the databases + touch /etc/ctdb/state/samba/periodic_cleanup + } + testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && { echo "`date` ERROR: testparm shows smb.conf is not clean" exit 1 -- 2.47.3