diff --git a/debian/changelog b/debian/changelog index f84dba0..3613df1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +remote-backup (1.5.3) stable; urgency=low + + * Use rsync --fake-super when running as user + + -- Vincent Riquer Wed, 15 Feb 2012 09:15:16 +0100 + remote-backup (1.5.2) stable; urgency=low * close log before printing failed backups info diff --git a/remote-backup b/remote-backup index 1c5f8cb..39099fa 100755 --- a/remote-backup +++ b/remote-backup @@ -185,10 +185,12 @@ runBackup() { if [[ $2 == PROTOCOLMISMATCH ]] then + # Protocol mismatch occurred, maybe caused by multiple --link-dest + # occurrences with rsync server protocol < 29 proto29=1 MAX_ROTATE=1 fi - for (( backup_num=0 ; backup_num <= MAX_ROTATE ; backup_num++ )) + for (( backup_num=1 ; backup_num <= MAX_ROTATE ; backup_num++ )) do if [ -d "$SNAPSHOT_RW/$NAME/daily.$backup_num" ] then @@ -209,6 +211,14 @@ runBackup() { RSYNC_OPTS="$RSYNC_OPTS --timeout=1800" fi + # Not root? use --fake-super + if (( UID > 0 )) + then + echo "(info) running as user, using --fake-super." + RSYNC_OPTS="$RSYNC_OPTS --fake-super" + fi + + for (( try=1 ; try <= RETRY ; try++ )) do $RSYNC \ @@ -226,13 +236,22 @@ runBackup() { break ;; *) - cat <<-EOF - - Trial $try / $RETRY failed. - Sleeping $RETRY_DELAY... + if (( try == RETRY )) + then + cat <<-EOF - EOF - sleep $RETRY_DELAY + Trial $try / $RETRY failed, Giving up! + + EOF + else + cat <<-EOF + + Trial $try / $RETRY failed. + Sleeping $RETRY_DELAY... + + EOF + sleep $RETRY_DELAY + fi ;; esac done @@ -266,13 +285,6 @@ runBackup() { unset proto29 } -# make sure we're running as root -if [ ! $UID -eq 0 ] -then - echo "Sorry, must be root. Exiting..." - exit -fi - openLog if [ -n "$EMERG" ]