Commit 7115bc91 authored by Mikaël Salson's avatar Mikaël Salson
Browse files

backup.sh: Get the directories from defs.py instead of hardcoding them

parent f9adbe88
......@@ -24,14 +24,24 @@ now=$(date +"%Y-%m-%d_%H:%M:%S")
vidjil_path=web2py/applications/vidjil
db_backup_file=/tmp/db-backup-$now.csv
defs_py=$vidjil_path/modules/defs.py
if [ ! -f "$defs_py" ]; then
echo "$defs_py doesn't exist. Is the Vidjil server fully installed?" >&2
exit 2
fi
DIR_SEQUENCES=$(sed -rn "s/^DIR_SEQUENCES.*['\"](.*)['\"].*$/\1/p" $defs_py)
DIR_RESULTS=$(sed -rn "s/^DIR_RESULTS.*['\"](.*)['\"].*$/\1/p" $defs_py)
python web2py/web2py.py -S vidjil -M -R "applications/vidjil/scripts/backup-db.py" -A "$db_backup_file"
if [ $COMPLETE -eq 1 ]; then
filename="${DIR}backup_"$now
zip -r $filename web2py/applications/vidjil/databases/ /mnt/result/results/ /mnt/upload/uploads/ $db_backup_file
zip -r $filename web2py/applications/vidjil/databases/ "$DIR_SEQUENCES" "$DIR_RESULTS" $db_backup_file
else
filename="${DIR}backup_essentials_"$now
zip -r $filename web2py/applications/vidjil/databases/ /mnt/result/results/ $db_backup_file
zip -r $filename web2py/applications/vidjil/databases/ "$DIR_RESULTS" $db_backup_file
fi
rm -f "$db_backup_file"
echo $filename
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