Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
0bcc9db5
Commit
0bcc9db5
authored
Nov 07, 2017
by
Mathieu Giraud
Browse files
server/backup.sh: -i, incremental backup
See vdj#531.
parent
6b586ebf
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/backup.sh
View file @
0bcc9db5
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment