+
+# 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
+