Exclude tmp dir from pruning
authorBernie Innocenti <bernie@codewiz.org>
Mon, 25 Jul 2011 20:07:01 +0000 (16:07 -0400)
committerFSF BOFH <sysadmin-nonrt@fsf.org>
Mon, 25 Jul 2011 20:07:01 +0000 (16:07 -0400)
wizbackup

index f47d7f8c98efcdbd5c7a8607add6b7af3cea2880..034651a997fd3747d17f4c4c257ed3bda82796df 100755 (executable)
--- a/wizbackup
+++ b/wizbackup
@@ -12,8 +12,7 @@
 # or (at your option) any later version.
 
 
-if [ $# -lt 2 ]
-then
+if [ $# -lt 2 ]; then
        echo "Usage: $0 SOURCE DEST [RSYNC_OPTS]"
        exit 1
 fi
@@ -99,7 +98,7 @@ do_init()
 
 do_prune()
 {
-       local old="`ls | head -n -$N_SNAPSHOT`"
+       local old="`ls | grep -v tmp | head -n -$N_SNAPSHOT`"
        if [ ! -z "$old" ]; then
                echo "$(date): Removing oldest snapshot(s): $old..."
                rm -rf "$old" || exit 669
@@ -108,7 +107,7 @@ do_prune()
 
 do_link()
 {
-       local newest=`ls | tail -n 1`
+       local newest=`ls | grep  -v tmp | tail -n 1`
        if [ -z "$newest" ]; then
                echo "$(date): No previous snapshot found, performing a full backup!"
        elif [ -d "$DEST/tmp" ]; then