Hallo zusammen,
kann mir jemand helfen, dass vergebene Backupscript so anzupassen, das ich dort SSH ID Files nutzen kann?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #!/bin/bash # Simple backup with rsync # local-mode, tossh-mode, fromssh-mode SOURCES=(/root /etc /home /boot ) TARGET="/media/backup" # edit or comment with "#" #LISTPACKAGES=listdebianpackages # local-mode and tossh-mode MONTHROTATE=monthrotate # use DD instead of YYMMDD RSYNCCONF=(--delete) #MOUNTPOINT="/media/daten" # check local mountpoint #MAILREC="user@domain" #SSHUSER="sshuser" #FROMSSH="fromssh-server" #TOSSH="tossh-server" SSHPORT=22 ### do not edit ### MOUNT="/bin/mount"; FGREP="/bin/fgrep"; SSH="/usr/bin/ssh" LN="/bin/ln"; ECHO="/bin/echo"; DATE="/bin/date"; RM="/bin/rm" DPKG="/usr/bin/dpkg"; AWK="/usr/bin/awk"; MAIL="/usr/bin/mail" CUT="/usr/bin/cut"; TR="/usr/bin/tr"; RSYNC="/usr/bin/rsync" LAST="last"; INC="--link-dest=$TARGET/$LAST" LOG=$0.log $DATE > $LOG if [ "${TARGET:${#TARGET}-1:1}" != "/" ]; then TARGET=$TARGET/ fi if [ "$LISTPACKAGES" ] && [ -z "$FROMSSH" ]; then $ECHO "$DPKG --get-selections | $AWK '!/deinstall|purge|hold/'|$CUT -f1 | $TR '\n' ' '" >> $LOG $DPKG --get-selections | $AWK '!/deinstall|purge|hold/'|$CUT -f1 |$TR '\n' ' ' >> $LOG 2>&1 fi if [ "$MOUNTPOINT" ]; then MOUNTED=$($MOUNT | $FGREP "$MOUNTPOINT"); fi if [ -z "$MOUNTPOINT" ] || [ "$MOUNTED" ]; then if [ -z "$MONTHROTATE" ]; then TODAY=$($DATE +%y%m%d) else TODAY=$($DATE +%d) fi if [ "$SSHUSER" ] && [ "$SSHPORT" ]; then S="$SSH -p $SSHPORT -l $SSHUSER"; fi for SOURCE in "${SOURCES[@]}" do if [ "$S" ] && [ "$FROMSSH" ] && [ -z "$TOSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$FROMSSH:$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} $TARGET$TODAY $INC" >> $LOG $RSYNC -e "$S" -avR "$FROMSSH:\"$MOUNTPOINT$SOURCE\"" "${RSYNCCONF[@]}" "$TARGET"$TODAY $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if [ "$S" ] && [ "$TOSSH" ] && [ -z "$FROMSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} \"$TOSSH:$TARGET$TODAY\" $INC " >> $LOG $RSYNC -e "$S" -avR "$MOUNTPOINT$SOURCE" "${RSYNCCONF[@]}" "$TOSSH:\"$TARGET\"$TODAY" $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if [ -z "$S" ]; then $ECHO "$RSYNC -avR \"$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} $TARGET$TODAY $INC" >> $LOG $RSYNC -avR "$MOUNTPOINT$SOURCE" "${RSYNCCONF[@]}" "$TARGET"$TODAY $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi done if [ "$S" ] && [ "$TOSSH" ] && [ -z "$FROMSSH" ]; then $ECHO "$SSH -p $SSHPORT -l $SSHUSER $TOSSH $LN -nsf $TARGET$TODAY $TARGET$LAST" >> $LOG $SSH -p $SSHPORT -l $SSHUSER $TOSSH "$LN -nsf \"$TARGET\"$TODAY \"$TARGET\"$LAST" >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if ( [ "$S" ] && [ "$FROMSSH" ] && [ -z "$TOSSH" ] ) || ( [ -z "$S" ] ); then $ECHO "$LN -nsf $TARGET$TODAY $TARGET$LAST" >> $LOG $LN -nsf "$TARGET"$TODAY "$TARGET"$LAST >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi else $ECHO "$MOUNTPOINT not mounted" >> $LOG ERROR=1 fi $DATE >> $LOG if [ -n "$MAILREC" ]; then if [ $ERROR ];then $MAIL -s "Error Backup $LOG" $MAILREC < $LOG else $MAIL -s "Backup $LOG" $MAILREC < $LOG fi fi |
Das Script ist das Beispielscript von folgender Seite: https://wiki.ubuntuusers.de/Skripte/Backup_mit_RSYNC/
Ich habe schon recht viel rumprobiert aber bekomme jedes mal eine Passwort Aufforderung.
Ich sage schonmal Danke.