From: Ralph Ronnquist Date: Fri, 5 Nov 2021 03:50:21 +0000 (+1100) Subject: added namelist for preserving snapshots selectively X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=dc1e014b0b34c85c571438bd69921d4cfd86a87d;p=rrq%2Fnilfs2sss.git added namelist for preserving snapshots selectively --- diff --git a/sss.sh b/sss.sh index 00c8d1a..4c2347c 100755 --- a/sss.sh +++ b/sss.sh @@ -8,6 +8,11 @@ # # The cron bot is expected to run once a minute +# Name of snapshot tag file for "important" snapshots. Format: +# $CNO .... one line for each $CNO that should be preserved as snapshot +# chcp ss $CNO && echo $CNO >> $NAMELIST +NAMELIST=/etc/nilfs2sss.list + # The hour-of-day to preserve as daily snapshot KEEPHH=12 @@ -34,7 +39,11 @@ YEARLY="$(date -d '-1 year' '+%Y-%m-%d %H:%M:%S')" MARK=( ) function marksnap() { if [[ "${MARK[0]}" == "$1" ]] && [[ "${MARK[1]}" = "$2" ]] ; then - chcp cp $DEV ${MARK[2]} + if [ -r "$NAMELIST" ] && grep -q ^$3 "$NAMELIST" ; then + : # Don't change important snapshots + else + chcp cp $DEV ${MARK[2]} + fi fi MARK=( "$1" "$2" "$3" ) }