2016-03-18 18:38:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2020-11-17 23:55:57 +01:00
|
|
|
# Import common cmd
|
|
|
|
source ../settings/scripts/experimental_helper.sh
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Loading installation settings..."
|
2019-06-07 23:09:30 +02:00
|
|
|
|
|
|
|
# retrieve useful param
|
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
2020-12-06 21:39:09 +01:00
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
2020-12-06 21:39:09 +01:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
|
|
|
# BACKUP SOGO CONFIG
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/$app"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP STUNNEL CONFIG
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/stunnel/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP VARIOUS FILES
|
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
|
|
|
|
# Backup Cron
|
2020-12-06 21:39:09 +01:00
|
|
|
ynh_backup --src_path="/etc/cron.d/$app"
|
2019-06-07 23:09:30 +02:00
|
|
|
|
|
|
|
# Backup Logs
|
2020-12-06 21:39:09 +01:00
|
|
|
ynh_backup --src_path="/var/log/$app"
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Backing up database"
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
ynh_mysql_dump_db "$db_name" > db.sql
|
2019-06-07 23:09:30 +02:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|