add timeout, add interruption detection
This commit is contained in:
parent
b3a7fa44c9
commit
17b8b1d51d
15
debian/changelog
vendored
15
debian/changelog
vendored
@ -1,3 +1,18 @@
|
||||
remote-backup (1.2.1) stable; urgency=low
|
||||
|
||||
* add TIMEOUT parameter (defaults to 1800 seconds).
|
||||
|
||||
-- Vincent Riquer <v.riquer@b2f-concept.com> 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 <v.riquer@b2f-concept.com> Fri, 18 Nov 2011 15:29:48 +0100
|
||||
|
||||
remote-backup (1.1.1) stable; urgency=low
|
||||
|
||||
* Skip rotation if previous backup failed.
|
||||
|
||||
@ -6,3 +6,4 @@ EXCLUDES=/dev/null
|
||||
DEST=""
|
||||
MAX_ROTATE=7
|
||||
BWLIMIT=0 # kBps
|
||||
TIMEOUT=1800
|
||||
|
||||
@ -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++ ))
|
||||
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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user