Commit 59646436 authored by Boxiang Sun's avatar Boxiang Sun Committed by Thomas Gambier

recipe/pbs: Update the rdiff-backup commands

parent 1199c4f7
...@@ -74,10 +74,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -74,10 +74,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
export LC_ALL export LC_ALL
RDIFF_BACKUP=%(rdiffbackup_binary)s RDIFF_BACKUP=%(rdiffbackup_binary)s
$RDIFF_BACKUP \\ $RDIFF_BACKUP \\
--api-version 201 \\
--remote-schema %(remote_schema)s \\ --remote-schema %(remote_schema)s \\
--restore-as-of now \\
--ignore-numerical-ids \\
--force \\ --force \\
restore --at now \\
%(local_dir)s \\ %(local_dir)s \\
%(remote_dir)s %(remote_dir)s
""") """)
...@@ -132,10 +132,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -132,10 +132,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
CORRUPTED_ARGS="" CORRUPTED_ARGS=""
if [ "$1" = "--fix-corrupted" ]; then if [ "$1" = "--fix-corrupted" ]; then
VERIFY=$($RDIFF_BACKUP --verify $BACKUP_DIR 2>&1 >/dev/null) VERIFY=$($RDIFF_BACKUP --api-version 201 verify $BACKUP_DIR 2>&1 >/dev/null)
echo "$VERIFY" | egrep "$CORRUPTED_MSG" | sed "s/$CORRUPTED_MSG//g" > $CORRUPTED_FILE echo "$VERIFY" | egrep "$CORRUPTED_MSG" | sed "s/$CORRUPTED_MSG//g" > $CORRUPTED_FILE
# Sometimes --verify reports this spurious warning: # Sometimes verify reports this spurious warning:
echo "$VERIFY" | egrep "$CANTFIND_MSG" | sed "s/$CANTFIND_MSG\(.*\),/--always-snapshot\ '\\1'/g" > $CANTFIND_FILE echo "$VERIFY" | egrep "$CANTFIND_MSG" | sed "s/$CANTFIND_MSG\(.*\),/--always-snapshot\ '\\1'/g" > $CANTFIND_FILE
# There can be too many files, better not to provide them through separate command line parameters # There can be too many files, better not to provide them through separate command line parameters
...@@ -149,8 +149,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -149,8 +149,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
fi fi
$RDIFF_BACKUP \\ $RDIFF_BACKUP \\
--api-version 201 \\
$CORRUPTED_ARGS \\ $CORRUPTED_ARGS \\
--remote-schema %(remote_schema)s \\ --remote-schema %(remote_schema)s \\
backup \\
%(remote_dir)s \\ %(remote_dir)s \\
$BACKUP_DIR $BACKUP_DIR
...@@ -162,7 +164,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -162,7 +164,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
# Check the backup, go to the last consistent backup, so that next # Check the backup, go to the last consistent backup, so that next
# run will be okay. # run will be okay.
echo "Checking backup directory..." echo "Checking backup directory..."
$RDIFF_BACKUP --check-destination-dir $BACKUP_DIR $RDIFF_BACKUP --api-version 201 regress $BACKUP_DIR
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
# Here, two possiblities: # Here, two possiblities:
if [ is_first_backup ]; then if [ is_first_backup ]; then
...@@ -178,9 +180,17 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -178,9 +180,17 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
fi fi
else else
# Everything's okay, cleaning up... # Everything's okay, cleaning up...
$RDIFF_BACKUP --remove-older-than %(remove_backup_older_than)s --force $BACKUP_DIR echo "Cleaning backup directory..."
$RDIFF_BACKUP list increments $BACKUP_DIR
if [ ! $? -eq 0 ]; then
# There has some increments, do the cleaning
# XXX: How to check the increments is older than %(remove_backup_older_than)s?
$RDIFF_BACKUP --api-version 201 --force remove increments --older-than %(remove_backup_older_than)s $BACKUP_DIR
fi
fi fi
""") """)
template_dict = { template_dict = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment