Commit 0bcc9db5 authored by Mathieu Giraud's avatar Mathieu Giraud

server/backup.sh: -i, incremental backup

See vdj#531.
parent 6b586ebf
......@@ -28,6 +28,8 @@ if [ $# -ge 1 ]; then
fi
now=$(date +"%Y-%m-%d_%H:%M:%S")
FIRST_OF_THE_MONTH=$(date --date="$(date +%Y-%m-01)" +"%Y-%m-%d")
vidjil_path=web2py/applications/vidjil
db_backup_file=/tmp/db-backup-$now.csv
......@@ -41,13 +43,19 @@ 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"
# python web2py/web2py.py -S vidjil -M -R "applications/vidjil/scripts/backup-db.py" -A "$db_backup_file"
touch $db_backup_file
if [ $COMPLETE -eq 1 ]; then
filename="${DIR}backup_"$now
zip -r $filename web2py/applications/vidjil/databases/ "$DIR_SEQUENCES" "$DIR_RESULTS" $db_backup_file
else
if [ $INCREMENTAL -eq 1 ]; then
filename_raw="${DIR}backup_incremental_${FIRST_OF_THE_MONTH}__${now}.tar"
filename=$filename_raw.gz
tar cvf $filename_raw --force-local web2py/applications/vidjil/databases/ # $db_backup_file
tar rvf $filename_raw --force-local --after-date "$FIRST_OF_THE_MONTH" "$DIR_RESULTS" 2>&1 | grep -v "file is unchanged"
gzip $filename_raw
else
filename="${DIR}backup_essentials_"$now
zip -r $filename web2py/applications/vidjil/databases/ "$DIR_RESULTS" $db_backup_file
......
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