]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add: backup history
authorBastian Dehn <hhaalo@arcor.de>
Wed, 28 Nov 2018 19:52:32 +0000 (20:52 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 28 Nov 2018 20:20:50 +0000 (21:20 +0100)
backup

diff --git a/backup b/backup
index 75efac7cb31dffa772c00a0f317914225d6a3f95..e2bb11cf95bf2a60ef8d39a0bc1f1666a730e7ec 100755 (executable)
--- a/backup
+++ b/backup
@@ -309,6 +309,39 @@ CleanUpBackups()
        fi
 }
 
+MakeHistory()
+{
+       if [ -f "$backpath/day" ]; then
+               echo "$(date +%Y-%m-%d)" > $backpath/day
+               echo "$(date +%Y-%m-%d)" > day
+               echo "$(date +%Y-%m-%d) day" >> backuphistory
+       elif [ -f "$backpath/week" ]; then
+               echo "$(date +%Y-%m-%d)" > $backpath/week
+               echo "$(date +%Y-%m-%d)" > week
+               echo "$(date +%Y-%m-%d) week" >> backuphistory
+       elif [ -f "$backpath/month" ]; then
+               echo "$(date +%Y-%m-%d)" > $backpath/month
+               echo "$(date +%Y-%m-%d)" > month
+               echo "$(date +%Y-%m-%d) month" >> backuphistory
+       else
+               echo "$(date +%Y-%m-%d)" > $backpath/none
+               echo "$(date +%Y-%m-%d)" > none
+               echo "$(date +%Y-%m-%d) none" >> backuphistory
+       fi
+
+       printfStripLine
+       printf "\n"
+       for i in day week month; do
+               if [ -f "$i" ]; then
+                       printf "Letzte Sicherung %s am %s\n" "$i" "$(cat $i)"
+               else
+                       printf "Keine Sicherung %s vorhanden\n" "$i"
+               fi
+       done
+       printf "\n"
+       printfStripLine
+}
+
 main()
 {
        YELLOW="\e[0;33m"
@@ -324,6 +357,8 @@ main()
 
        BackupRemotePC
 
+       MakeHistory
+
        CleanUpBackups
 }