diff --git a/debian/changelog b/debian/changelog index 59bc4f5..8d367f1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +remote-backup (1.2.1) stable; urgency=low + + * add TIMEOUT parameter (defaults to 1800 seconds). + + -- Vincent Riquer Thu, 02 Feb 2012 15:14:06 +0100 + +remote-backup (1.2.0) stable; urgency=low + + * use all increments for linking + * detect interruption, skip rotation next time (prevents loosing everything + if it fails more than MAX_ROTATE times in a row) + * use functions + + -- Vincent Riquer Fri, 18 Nov 2011 15:29:48 +0100 + remote-backup (1.1.1) stable; urgency=low * Skip rotation if previous backup failed. diff --git a/defaults.conf b/defaults.conf index bb0410d..920fc90 100644 --- a/defaults.conf +++ b/defaults.conf @@ -6,3 +6,4 @@ EXCLUDES=/dev/null DEST="" MAX_ROTATE=7 BWLIMIT=0 # kBps +TIMEOUT=1800 diff --git a/remote-backup b/remote-backup index 4725092..a0639a4 100755 --- a/remote-backup +++ b/remote-backup @@ -155,35 +155,46 @@ rotateBackup() { runBackup() { # step 3: rsync from the system, linking to latest snapshot if files are # identical. - RSYNC_OPTS="-a \ - --exclude-from=$EXCLUDES \ - --bwlimit=$BWLIMIT" + RSYNC_OPTS="-a --exclude-from=$EXCLUDES --bwlimit=$BWLIMIT" - for((backup_num=0;backup_num <= MAX_ROTATE;backup_num++)) + for (( backup_num=0 ; backup_num <= MAX_ROTATE ; backup_num++ )) do if [ -d "$SNAPSHOT_RW/$NAME/daily.$backup_num" ] then - RSYNC_OPTS="$RSYNC_OPTS \ - --link-dest=$SNAPSHOT_RW/$NAME/daily.$backup_num" + RSYNC_OPTS="$RSYNC_OPTS --link-dest=$SNAPSHOT_RW/$NAME/daily.$backup_num" fi done for old_backup in "$SNAPSHOT_RW/$NAME/emerg".* do if [ -d "$old_backup" ] then - RSYNC_OPTS="$RSYNC_OPTS \ - --link-dest=$old_backup" + RSYNC_OPTS="$RSYNC_OPTS --link-dest=$old_backup" fi done + if (( TIMEOUT )) + then + RSYNC_OPTS="$RSYNC_OPTS --timeout=$TIMEOUT" + else + RSYNC_OPTS="$RSYNC_OPTS --timeout=1800" + fi $RSYNC \ $RSYNC_OPTS \ "${REMOTE_LOCATION}" \ - "$SNAPSHOT_RW/$NAME/$1" \ - || if [ -d "$SNAPSHOT_RW/$NAME/$1" ] + "$SNAPSHOT_RW/$NAME/$1" + if (( $? == 10 )) \ + || (( $? == 12 )) \ + || (( $? == 20 )) \ + || (( $? == 21 )) \ + || (( $? == 22 )) \ + || (( $? == 23 )) \ + || (( $? == 30 )) + then + if [ -d "$SNAPSHOT_RW/$NAME/$1" ] then touch "$SNAPSHOT_RW/$NAME/$1/unfinished.remote-backup" fi + fi # step 5: update the mtime of daily.0 to reflect the snapshot time $TOUCH "$SNAPSHOT_RW/$NAME/$1"