From dc1e014b0b34c85c571438bd69921d4cfd86a87d Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Fri, 5 Nov 2021 14:50:21 +1100 Subject: [PATCH] added namelist for preserving snapshots selectively --- sss.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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" ) } -- 2.39.2