From: Bernie Innocenti Date: Mon, 25 Jul 2011 20:07:01 +0000 (-0400) Subject: Exclude tmp dir from pruning X-Git-Url: https://codewiz.org/gitweb?p=wizbackup.git;a=commitdiff_plain;h=188a17dc90f321be843f2f577023f3a2720afa50;hp=94ba89bdb76cb598d62bcb555197a1dfdbb134fd Exclude tmp dir from pruning --- diff --git a/wizbackup b/wizbackup index f47d7f8..034651a 100755 --- 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