From 9602af81a13f1706b19ae36eef2cdc8356bbc868 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Sat, 5 Dec 2020 13:13:51 +1100 Subject: [PATCH] corrected comparisons --- sss.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sss.sh b/sss.sh index d1c581c..c514643 100755 --- a/sss.sh +++ b/sss.sh @@ -28,7 +28,7 @@ date "+%Y-%m-%d %H:%M:%S ---- checking" >&2 lscp -s | while read CNO DATE TIME REST ; do TS="$DATE $TIME" [ "$CNO" = "CNO" ] && continue - if [[ "$TS" < "$YEARLY" ]] ; then + if [[ ! "$TS" > "$YEARLY" ]] ; then if [ "$KEEPYY" = "${DATE:0:4}" ] ; then echo "# discard year duplicate $CNO $DATE $TIME" >&2 chcp cp $CNO @@ -39,7 +39,7 @@ lscp -s | while read CNO DATE TIME REST ; do continue fi # Within last year - if [[ "$TS" < "$MONTHLY" ]] ; then + if [[ ! "$TS" > "$MONTHLY" ]] ; then if [ "$KEEPMM" = "${DATE:0:7}" ] ; then echo "# discard month duplicate $CNO $DATE $TIME" >&2 chcp cp $CNO @@ -48,7 +48,7 @@ lscp -s | while read CNO DATE TIME REST ; do fi fi # Within last month - if [[ "$TS" < "$WEEKLY" ]] ; then + if [[ ! "$TS" > "$WEEKLY" ]] ; then if [[ "$KEEPDD" = "${DATE:8:2}" ]] ; then if [ -z "$KEEPWW" ] ; then KEEPWW="${DATE:8:2}" @@ -62,14 +62,14 @@ lscp -s | while read CNO DATE TIME REST ; do continue fi # Within last week - if [[ "$TS" < "$DAILY" ]] ; then + if [[ ! "$TS" > "$DAILY" ]] ; then [[ "$KEEPHH" = "${TIME:0:2}" ]] && continue echo "# discard not hour $KEEPHH: $CNO $DATE $TIME" >&2 chcp cp $CNO continue fi # Within last day - if [[ "$TS" < "$HOURLY" ]] ; then + if [[ ! "$TS" > "$HOURLY" ]] ; then if [ "$KEEP55" = "${TIME:0:2}" ] ; then echo "# discard duplicate for hour $KEEP55: $CNO $DATE $TIME" >&2 chcp cp $CNO @@ -81,12 +81,12 @@ lscp -s | while read CNO DATE TIME REST ; do fi # Within last hour #echo "# keep within last hour $CNO $DATE $TIME" >&2 - [[ "$TS" < "$FIVELY" ]] && continue + [[ ! "$TS" > "$FIVELY" ]] && continue echo "$CNO $DATE $TIME is within last five minutes" #echo "# $CNO is within last five minutes " >&2 done | if read X ; then : -else +elif [[ $(( $(date +%M) % 5 )) = 0 ]] ; then date "+# new snapshot at %Y-%m-%d %H:%M:%S" >&2 mkcp -s $DEV fi -- 2.39.2