Added instruction on how to activate database backup. Improved backup script.

pull/39/head
Cédric Bonhomme 2017-08-08 09:38:30 +02:00
parent 809de38e57
commit 2f7e2078e7
No known key found for this signature in database
GPG Key ID: A1CB94DE57B7A70D
2 changed files with 21 additions and 4 deletions

View File

@ -205,6 +205,24 @@ This script will retrieve the updates from the last stable release of MONARC.
It uses others shell scripts. You may need to change the access rights of those It uses others shell scripts. You may need to change the access rights of those
scripts. scripts.
Before updating MONARC it is advised to configure database backup. For that you
just need to create a file __data/backup/credentialsmysql.cnf__:
[client]
host = localhost
user = sql-monarc-user
password = your-password
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = sql-monarc-user
password = your-password
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
If this file is not present, a warning message will be displayed during the
backup.
Create Initial User and Client Create Initial User and Client
------------------------------ ------------------------------

View File

@ -116,15 +116,14 @@ else
fi fi
if [[ $bypass -eq 0 ]]; then if [[ $bypass -eq 0 ]]; then
if [ -e data/dbcredentials/credentialsmysql.cnf ]; then if [ -e data/backup/credentialsmysql.cnf ]; then
echo "Dumping database to data/backup"
mkdir data/backup/
backupdir=data/backup/$(date +"%Y%m%d_%H%M%S") backupdir=data/backup/$(date +"%Y%m%d_%H%M%S")
mkdir $backupdir mkdir $backupdir
echo -e "\e[32mDumping database to $backupdir...\e[0m"
mysqldump --defaults-file=data/dbcredentials/credentialsmysql.cnf --databases monarc_common > $backupdir/dump-common.sql mysqldump --defaults-file=data/dbcredentials/credentialsmysql.cnf --databases monarc_common > $backupdir/dump-common.sql
mysqldump --defaults-file=data/dbcredentials/credentialsmysql.cnf --databases monarc_cli > $backupdir/dump-cli.sql mysqldump --defaults-file=data/dbcredentials/credentialsmysql.cnf --databases monarc_cli > $backupdir/dump-cli.sql
else else
echo "Database backup not configured. Skipping." echo -e "\e[93mDatabase backup not configured. Skipping.\e[0m"
fi fi
migrate_module $phpcommand $pathCore migrate_module $phpcommand $pathCore