From b3c0f4a45ac706e31d5d9e068fc0624a635af847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 11 Dec 2023 11:46:49 +0100 Subject: [PATCH] Rework doc, stop/start service on backup --- doc/{DISCLAIMER.md => ADMIN.md} | 36 +++------------------------------ doc/DESCRIPTION.md | 4 +++- scripts/backup | 16 ++++++++++++--- 3 files changed, 19 insertions(+), 37 deletions(-) rename doc/{DISCLAIMER.md => ADMIN.md} (86%) diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 86% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 75a5236..6ae8fb1 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -1,34 +1,3 @@ -### Upgrade - -By default, a backup is performed before upgrading. To avoid this, you have the following options: -- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. For example `NO_BACKUP_UPGRADE=1 yunohost app upgrade monitorix`. -- Set `disable_backup_before_upgrade` to `1`. You can set it with this command: - -`yunohost app setting monitorix disable_backup_before_upgrade -v 1` - -After that, the settings will be applied for **all** the next updates. - -From command line: - -`yunohost app upgrade monitorix` - -### Backup - -This application now uses the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration it is recommended to proceed as follows: - -- Stop Monitorix service with this command: - -`systemctl stop monitorix.service` - -- Launch Monitorix backup with this command: - -`yunohost backup create --app monitorix` - -- Backup your data with your specific strategy (could be with rsync, borg backup or just cp). The data is generally stored in `/var/lib/monitorix`. -- Restart Monitorix service with theses command: - -`systemctl start monitorix.service` - ### Remove Due of the backup core only feature the data directory in `/var/lib/monitorix` **is not removed**. It must be manually deleted to purge user data from the app. @@ -45,7 +14,7 @@ You will have a full complete documentation for monitorix config here : https:// By example you can extends the basic config by this : -``` +```xml priority = 5 @@ -238,7 +207,8 @@ priority = 5 ``` -In this config we have : +In this config : + - We set the process priority to 5 (which mean that it will be lower priority than the other process). - We get the lmsensor sensor data. - We get some sensors data not accessible with lmsensor (with gensens) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 1324d1f..ee0f79b 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1,3 @@ -Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well. +Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as many services and system resources as possible. + +It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well. diff --git a/scripts/backup b/scripts/backup index 0ba5e51..170984d 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,9 +10,12 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -if [[ ! "$(systemctl status $app.service)" =~ "Active: inactive (dead)" ]]; then - ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service and with this command before to run the backup 'systemctl stop $app.service'" -fi +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -52,6 +55,13 @@ ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql +#================================================= +# RESTART APP +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +_ynh_systemd_restart_monitorix + #================================================= # END OF SCRIPT #=================================================