From 2f7e2078e73c0871bfad824f5e0d029272684116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Tue, 8 Aug 2017 09:38:30 +0200 Subject: [PATCH] Added instruction on how to activate database backup. Improved backup script. --- INSTALL/INSTALL.ubuntu1704.md | 18 ++++++++++++++++++ scripts/update-all.sh | 7 +++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/INSTALL/INSTALL.ubuntu1704.md b/INSTALL/INSTALL.ubuntu1704.md index a20f702..3ec4f09 100644 --- a/INSTALL/INSTALL.ubuntu1704.md +++ b/INSTALL/INSTALL.ubuntu1704.md @@ -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 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 ------------------------------ diff --git a/scripts/update-all.sh b/scripts/update-all.sh index 9c96f5e..ae7a2f8 100755 --- a/scripts/update-all.sh +++ b/scripts/update-all.sh @@ -116,15 +116,14 @@ else fi if [[ $bypass -eq 0 ]]; then - if [ -e data/dbcredentials/credentialsmysql.cnf ]; then - echo "Dumping database to data/backup" - mkdir data/backup/ + if [ -e data/backup/credentialsmysql.cnf ]; then backupdir=data/backup/$(date +"%Y%m%d_%H%M%S") 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_cli > $backupdir/dump-cli.sql else - echo "Database backup not configured. Skipping." + echo -e "\e[93mDatabase backup not configured. Skipping.\e[0m" fi migrate_module $phpcommand $pathCore