feat(borg_exporter): add borg last archive

with native borg command (list --last 1)
This commit is contained in:
Grounz 2020-02-03 11:46:23 +01:00 committed by GitHub
parent c12741435e
commit 52126ed8a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ COUNTER=0
[ -e $TEXTFILE_COLLECTOR_DIR ] || mkdir -p $TEXTFILE_COLLECTOR_DIR
COUNTER=$(echo "$ARCHIVES" | wc -l)
LAST_ARCHIVE=$(BORG_PASSPHRASE=$BORG_PASSPHRASE borg list $REPOSITORY | sort -nr | head -n 1)
LAST_ARCHIVE=$(BORG_PASSPHRASE=$BORG_PASSPHRASE borg list --last 1 $REPOSITORY)
LAST_ARCHIVE_NAME=$(echo $LAST_ARCHIVE | awk '{print $1}')
LAST_ARCHIVE_DATE=$(echo $LAST_ARCHIVE | awk '{print $3" "$4}')
LAST_ARCHIVE_TIMESTAMP=$(date -d "$LAST_ARCHIVE_DATE" +"%s")