]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
add: restore with ssh port
authorBastian Dehn <hhaalo@arcor.de>
Thu, 8 Nov 2018 17:46:56 +0000 (18:46 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 8 Nov 2018 17:51:34 +0000 (18:51 +0100)
restore

diff --git a/restore b/restore
index 07f727f783457f49636d8fb63c46e56aac54f947..88119f311d75e52151e2dbaa60da6fc188a94bee 100755 (executable)
--- a/restore
+++ b/restore
@@ -59,7 +59,10 @@ printfStripLine()
 
 RestoreData()
 {
-       remoteLogin="root@$rechner"
+       remoteuser=$(echo $rechner | sed 's/\(.*\)@.*/\1/')
+       remoterechner=$(echo $rechner | sed 's/.*@\(.*\):.*/\1/')
+       remoteport=$(echo $rechner | sed 's/.*@.*:\(.*\)/\1/')
+       remoteLogin=$remoteuser@$remoterechner
        backDir="$datum"_"$number"_"$backname"
        fullPathBackPath="$backpath/$backDir"
        local restoreLog="$backpath/restore-$(date +%Y-%m-%d).log"
@@ -78,15 +81,16 @@ RestoreData()
        printf "Pfad: %s\n\n" "$pfad" \
                | tee -a $restoreLog
        printf "rsync --archive --verbose --sparse --acls --hard-links \
---human-readable --log-file %s/%s %s/%s/%s %s:%s\n\n" \
-       "$backpath" "$restoreLog" "$fullPathBackPath" "$rechner" \
-       "$pfad" "$remoteLogin" "$pfad" | tee -a $restoreLog
+--human-readable --rsh \"ssh -p %s\" --log-file %s/%s %s/%s/%s %s:%s\n\n" \
+       "$remoteport" "$backpath" "$restoreLog" "$fullPathBackPath" \
+       "$remoterechner" "$pfad" "$remoteLogin" "$pfad" | tee -a $restoreLog
        printfStripLine
 
 
        rsync --archive --verbose --sparse --acls --hard-links \
                --human-readable \
-               --log-file $restoreLog $fullPathBackPath/$rechner/$pfad \
+               --rsh "ssh -p $remoteport" \
+               --log-file $restoreLog $fullPathBackPath/$remoterechner/$pfad \
                $remoteLogin:$pfad
 }