1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00
monitorix_ynh/scripts/backup
2020-12-12 15:01:50 +01:00

41 lines
1.2 KiB
Bash
Executable file

#!/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)
#=================================================
# 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"
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."