#!/bin/bash #================================================= # GENERIC START #================================================= # Import common cmd source ../settings/scripts/experimental_helper.sh source ../settings/scripts/_common.sh # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors # Retrieve arguments ynh_print_info --message="Loading installation settings..." domain=$(ynh_app_setting_get --app $app --key domain) 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 #================================================= # STANDARD BACKUP STEPS #================================================= # Copy NGINX configuration ynh_print_info --message="Backing up configuration..." domain=$(ynh_app_setting_get --app $app --key domain) ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf" ynh_backup --src_path "/etc/nginx/conf.d/monitorix_status.conf" # Copy hook ynh_backup --src_path "/etc/yunohost/hooks.d/post_iptable_rules/50-$app" # Copy Monitorix configuration ynh_backup --src_path "/etc/monitorix" # Copy Monitorix data ynh_print_info --message="Backing up data..." ynh_backup --src_path "/var/lib/monitorix" --is_big=1 ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."