aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-10 23:05:29 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-10 23:05:29 -0300
commit359fb2757c41a8b92a780673d6d2739b6fdac660 (patch)
tree6f5469467700f1d398829823f3273b21908f9393 /lib
parenteeb907c24812123d98598246805b5613cd4b1f8a (diff)
downloadhydra-359fb2757c41a8b92a780673d6d2739b6fdac660.tar.gz
hydra-359fb2757c41a8b92a780673d6d2739b6fdac660.tar.bz2
Try to get the newest if there's no backup for the current date
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/backup10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/hydra/backup b/lib/hydra/backup
index e48f904..3f2d91f 100644
--- a/lib/hydra/backup
+++ b/lib/hydra/backup
@@ -17,6 +17,16 @@ function hydra_backup_environment_local_website {
RESTOREDIR="$BACKUPDIR/`date +%Y%m%d`"
fi
+ # Try to get the newest if there's no backup for the current date
+ if [ ! -e "$RESTOREDIR/$SITE.tar.bz2" ]; then
+ RESTOREDIR="$(find $BACKUPDIR -name "$SITE.tar.bz2" | sort -n | tail -n 1)"
+
+ if [ -z "$RESTOREDIR" ]; then
+ echo "Backup not found for $DATE."
+ exit 1
+ fi
+ fi
+
DB_DUMP_BASE="$RESTOREDIR"
mkdir -p $RESTOREDIR
}