From 481c2d5ff16953a69191cdc14f2c5ef54f45be33 Mon Sep 17 00:00:00 2001 From: mwolson_admin Date: Mon, 28 Jan 2008 02:24:48 -0500 Subject: [PATCH] hcoop-backup: Back up spamd directory specially. --- hcoop-backup | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 | \ -- 2.20.1