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
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
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}"
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
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