X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=sss.sh;h=4c2347cd0b1fdf4bbee27c0a744bccac3365a590;hb=d6fc08311a092f201086078482c71d62fc728410;hp=1f253d3b5bcf0caba4dced57b4881589d1f31468;hpb=74fe4e77e452b47d403fdc9117b2769f3121085c;p=rrq%2Fnilfs2sss.git diff --git a/sss.sh b/sss.sh index 1f253d3..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" ) } @@ -57,7 +66,7 @@ function marksnap() { elif [[ ! "$TS" > "$HOURLY" ]] ; then marksnap HOUR "${DATE:8:2}-${TIME:0:2}" $CNO else - echo "$CNO $DATE $TIME within last hour" + : # echo "$CNO $DATE $TIME within last hour" fi done | if read X ; then : # snapshot within last hour