diff options
author | Erich Eckner <git@eckner.net> | 2016-05-21 21:48:02 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-05-21 21:48:02 +0200 |
commit | 37830a9ebcaa283a0ec345b44ba91c669255600d (patch) | |
tree | 13196d4ab720d7fab1b997e71efceb02b61444fb | |
parent | de60f08ac30c1f5d5aada4e608271187a60f10c3 (diff) | |
download | hardlinkedBackups-37830a9ebcaa283a0ec345b44ba91c669255600d.tar.xz |
neue Version: 1.0.4v1.0.4
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | lastBackups.in.orig | 73 |
2 files changed, 74 insertions, 1 deletions
@@ -24,7 +24,7 @@ ETCDIR = /etc BINDIR = /usr/bin MANDIR = /usr/share/man -VERSION = 1.0.3 +VERSION = 1.0.4 all: hardlinkedbackups.8 backup lastBackups diff --git a/lastBackups.in.orig b/lastBackups.in.orig new file mode 100755 index 0000000..ea6040a --- /dev/null +++ b/lastBackups.in.orig @@ -0,0 +1,73 @@ +#!/bin/bash + +# lastBackups version #VERSION# + +. #ETCDIR#/backup.conf + +unset namen +unset veraltet +unset daten + +for backupID in ${!backups[@]} +do + dest="${backups["${backupID}"]%% *}" + dest="${dest%/}" + while [ ! -d "${dest}" ] && [ ${maxWait} -gt 0 ] + do + sleep 1 + maxWait=$[${maxWait}-1] + done + + lbu=$( + ls -1 ${dest} | \ + grep -v "^aktuell$" | \ + sed "s/^duplicity-\(inc\|full\)\.\(.*\.\)\?\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)T[0-9]\{6\}Z\..*$/\3_\4_\5/" | \ + sort -n | \ + uniq | \ + grep "^[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}$" | \ + tail -n1 + ) + [ "${lbu}" == "" ] && lbu="2000_01_01" + delta=$[$(date +%s) - $(date -d $(echo ${lbu} | sed "s/_//g") +%s)] + namen[${#namen[@]}]="$(basename $(echo ${dest} | sed "s#/\(${recognSubdirRegex}\)\$#_\1#" | sed "s#/rsync\$##; s#/duplicity\$##"))" + [ ! "$(ls -A ${dest}/${lbu})" ] && + veraltet[${#veraltet[@]}]="LEER!" || + [ ${delta} -gt ${outdatedLimit} ] && \ + veraltet[${#veraltet[@]}]="VERALTET!" || \ + veraltet[${#veraltet[@]}]="" + daten[${#daten[@]}]="${lbu}" +done + +nl=0 +vl=0 +dl=0 + +for ((i=0; i<${#namen[@]}; i++)) +{ + [ ${#namen[${i}]} -gt ${nl} ] && nl=${#namen[${i}]} + [ ${#veraltet[${i}]} -gt ${vl} ] && vl=${#veraltet[${i}]} + [ ${#daten[${i}]} -gt ${dl} ] && dl=${#daten[${i}]} +} + +for ((i=0; i<${#namen[@]}; i++)) +{ + while [ ${#namen[${i}]} -lt ${nl} ] + do + namen[${i}]="${namen[${i}]} " + done + while [ ${#veraltet[${i}]} -lt ${vl} ] + do + veraltet[${i}]="${veraltet[${i}]} " + done + while [ ${#daten[${i}]} -lt ${dl} ] + do + daten[${i}]="${daten[${i}]} " + done +} + +for ((i=0; i<${#namen[@]}; i++)) +{ + echo "${daten[${i}]} ${veraltet[${i}]} ${namen[${i}]} ${daten[${i}]}" +} | \ + sort | \ + sed "s/^\S\+\s//" |