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
|
remote-backup (1.1.1) stable; urgency=low
|
||||||
|
|
||||||
* Skip rotation if previous backup failed.
|
* Skip rotation if previous backup failed.
|
||||||
|
|||||||
@ -6,3 +6,4 @@ EXCLUDES=/dev/null
|
|||||||
DEST=""
|
DEST=""
|
||||||
MAX_ROTATE=7
|
MAX_ROTATE=7
|
||||||
BWLIMIT=0 # kBps
|
BWLIMIT=0 # kBps
|
||||||
|
TIMEOUT=1800
|
||||||
|
|||||||
@ -155,35 +155,46 @@ rotateBackup() {
|
|||||||
runBackup() {
|
runBackup() {
|
||||||
# step 3: rsync from the system, linking to latest snapshot if files are
|
# step 3: rsync from the system, linking to latest snapshot if files are
|
||||||
# identical.
|
# identical.
|
||||||
RSYNC_OPTS="-a \
|
RSYNC_OPTS="-a --exclude-from=$EXCLUDES --bwlimit=$BWLIMIT"
|
||||||
--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
|
do
|
||||||
if [ -d "$SNAPSHOT_RW/$NAME/daily.$backup_num" ]
|
if [ -d "$SNAPSHOT_RW/$NAME/daily.$backup_num" ]
|
||||||
then
|
then
|
||||||
RSYNC_OPTS="$RSYNC_OPTS \
|
RSYNC_OPTS="$RSYNC_OPTS --link-dest=$SNAPSHOT_RW/$NAME/daily.$backup_num"
|
||||||
--link-dest=$SNAPSHOT_RW/$NAME/daily.$backup_num"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for old_backup in "$SNAPSHOT_RW/$NAME/emerg".*
|
for old_backup in "$SNAPSHOT_RW/$NAME/emerg".*
|
||||||
do
|
do
|
||||||
if [ -d "$old_backup" ]
|
if [ -d "$old_backup" ]
|
||||||
then
|
then
|
||||||
RSYNC_OPTS="$RSYNC_OPTS \
|
RSYNC_OPTS="$RSYNC_OPTS --link-dest=$old_backup"
|
||||||
--link-dest=$old_backup"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if (( TIMEOUT ))
|
||||||
|
then
|
||||||
|
RSYNC_OPTS="$RSYNC_OPTS --timeout=$TIMEOUT"
|
||||||
|
else
|
||||||
|
RSYNC_OPTS="$RSYNC_OPTS --timeout=1800"
|
||||||
|
fi
|
||||||
|
|
||||||
$RSYNC \
|
$RSYNC \
|
||||||
$RSYNC_OPTS \
|
$RSYNC_OPTS \
|
||||||
"${REMOTE_LOCATION}" \
|
"${REMOTE_LOCATION}" \
|
||||||
"$SNAPSHOT_RW/$NAME/$1" \
|
"$SNAPSHOT_RW/$NAME/$1"
|
||||||
|| if [ -d "$SNAPSHOT_RW/$NAME/$1" ]
|
if (( $? == 10 )) \
|
||||||
|
|| (( $? == 12 )) \
|
||||||
|
|| (( $? == 20 )) \
|
||||||
|
|| (( $? == 21 )) \
|
||||||
|
|| (( $? == 22 )) \
|
||||||
|
|| (( $? == 23 )) \
|
||||||
|
|| (( $? == 30 ))
|
||||||
|
then
|
||||||
|
if [ -d "$SNAPSHOT_RW/$NAME/$1" ]
|
||||||
then
|
then
|
||||||
touch "$SNAPSHOT_RW/$NAME/$1/unfinished.remote-backup"
|
touch "$SNAPSHOT_RW/$NAME/$1/unfinished.remote-backup"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# step 5: update the mtime of daily.0 to reflect the snapshot time
|
# step 5: update the mtime of daily.0 to reflect the snapshot time
|
||||||
$TOUCH "$SNAPSHOT_RW/$NAME/$1"
|
$TOUCH "$SNAPSHOT_RW/$NAME/$1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user