[Dirvish] dirvish-tidy.sh

langelino langelino at gmx.net
Sat Feb 5 07:24:05 PST 2005


Dear Keith,

the dirvish-tidy.sh script

http://www.dirvish.org/wiki?DirvishTidyScript

is broken. There is a closing parenthesis missing.  Attached please find 
an updated one.
Changes:
- does not assume that the images are of the form %Y%...
- checks if dirvish is running before proceeding.
- changed  VAULT to its proper name BANK.


BTW, here is an email in which J.W. was getting pretty upset for being asked
to reveal his first name.  
http://lists.samba.org/archive/rsync/2003-April/005845.html

Apparently he didn't like to reveal it.. You may like to change the web 
site accordingly.

Thanks for putting up a dirvish cite.
Regards,

Matt
-------------- next part --------------
#!/bin/sh 

# Adjusted from the dirvish website
# M. Munnich 02/2005 

BANK=/backup/bank
# set -x

# Make sure no dirvish job is running
x=`ps -ef | grep dirvish | wc -l`
if [ $x -gt 3 ] ; then # 
	echo "Error: Dirvish is running. Stop." 
	exit 2
fi

cd $BANK || (echo "Error: Cannot cd into $BANK"; exit 1)
for v in * ; do # walk through vaults in bank
	if [ -d $v ]; then
		cd $v
		for i in * ; do # loop over images in bank
			if [ -d $i -a $i != "dirvish" ]; then
				if [ -f dirvish/daily.hist ]; then
					if [ `grep -c "^$i" dirvish/daily.hist` -eq 0 ]; then
						echo "Removing incomplete image $BANK/$v/$i"
						rm -rf $i
					fi
				fi
			fi
		done
		cd ..
	fi
done


More information about the Dirvish mailing list