summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xlastBackups.in.orig73
2 files changed, 74 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 2f36825..35bd6c6 100644
--- a/Makefile
+++ b/Makefile
@@ -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//"