]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add: restore-einfach
authorBastian Dehn <hhaalo@arcor.de>
Sun, 2 Jul 2017 16:54:10 +0000 (18:54 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 2 Jul 2017 16:54:10 +0000 (18:54 +0200)
backup
backup-einfach
restore-einfach [new file with mode: 0755]

diff --git a/backup b/backup
index d65a6c503c283198be39b0da3bc38f7302e1231d..b58f5b8cf5bd4f1f30c54dd9b38b78399baddf86 100755 (executable)
--- a/backup
+++ b/backup
@@ -104,3 +104,5 @@ else
        printf "Es wird %i Sicherungen vorhanden.\n\n" $backupanzahl
        printf "################################################################\n"
 fi
+
+exit 0
index 169440b3464928aa8cd7ccd2c60b953b09179839..87b1401235cca7729651507bd5aef6d7d6f43cef 100755 (executable)
@@ -28,3 +28,5 @@ for remoterechner in $(cat rechner.txt); do
                printf "################################################################\n"
        done
 done
+
+exit 0
diff --git a/restore-einfach b/restore-einfach
new file mode 100755 (executable)
index 0000000..6ef7bff
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+sicherungspfad="/images/backup"
+sicherungsordner="einfach-sicherung"
+
+while getopts "r:p:" optname; do
+       case "$optname" in
+       "r")
+               rechner="$OPTARG"
+               ;;
+       "p")
+               pfad="$OPTARG"
+               ;;
+       esac
+done
+
+if [ -z "$rechner" ] || [ -z "$pfad" ]; then
+       printf "Es fehlen Parameter!\n"
+       exit 1
+fi
+
+printf "################################################################\n"
+printf "Daten werden wiederhergestellt\n\n"
+printf "Pfad: %s\n" $pfad
+printf "Rechner: %s\n" $rechner
+printf "################################################################\n"
+
+rsync --archive --verbose --sparse --acls --hard-links --human-readable --log-file $sicherungspfad/restore-einfach-$(date +%Y-%m-%d).log $sicherungspfad/$sicherungsordner/$rechner/$pfad root@$rechner:$pfad
+
+exit 0