From: mwolson_admin Date: Mon, 28 Jan 2008 07:24:48 +0000 (-0500) Subject: hcoop-backup: Back up spamd directory specially. X-Git-Url: http://git.hcoop.net/clinton/scripts.git/commitdiff_plain/481c2d5ff16953a69191cdc14f2c5ef54f45be33 hcoop-backup: Back up spamd directory specially. --- diff --git a/hcoop-backup b/hcoop-backup index f5e1a1f..2dd4332 100755 --- a/hcoop-backup +++ b/hcoop-backup @@ -106,6 +106,33 @@ tar clpf - --ignore-failed-read --no-recursion -C / -T backupfiles | \ ccrypt -k $KEYFILE -e | \ catsync hcoop.backup.tar$COMPRESS_EXT.aescrypt + +# Acquire lock before messing with spamd +COUNT=0 +LOCK=/var/local/lib/spamd/.lock +while test -f $LOCK; do + sleep 2m + COUNT=$(expr $COUNT + 1) + if test $COUNT -eq 10; then + # Enough waiting. Kill the process. + P=$(cat $LOCK) || : + test -n "$P" && kill $P || : + rm -f $LOCK + break + fi +done +touch $LOCK + +tar clpf - --ignore-failed-read -C / /var/local/lib/spamd | \ + $COMPRESS_PROG | \ + ccrypt -k $KEYFILE -e | \ + catsync ../common.spamd.tar$COMPRESS_EXT.aescrypt.new +rm -f $LOCK + +test -s ../common.spamd.tar$COMPRESS_EXT.aescrypt.new && \ + mv ../common.spamd.tar$COMPRESS_EXT.aescrypt.new \ + ../common.spamd.tar$COMPRESS_EXT.aescrypt + vos listvol deleuze | \ tail -n +2 | \ head -n -3 | \