2017-07-23 17:46:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-04 11:43:51 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
2017-07-23 17:46:25 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-05-04 11:43:51 +02:00
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_clean_setup () {
|
|
|
|
ynh_clean_check_starting
|
|
|
|
}
|
2018-05-04 11:43:51 +02:00
|
|
|
# Exit if an error occurs during the execution of the script
|
2017-12-29 00:57:57 +01:00
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_backup --src_path="$final_path"
|
2017-07-23 17:46:25 +02:00
|
|
|
|
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2017-07-30 21:33:54 +02:00
|
|
|
#=================================================
|
2021-11-27 12:10:20 +01:00
|
|
|
# SPECIFIC BACKUP
|
2017-07-30 21:33:54 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# BACKUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
2017-07-30 21:33:54 +02:00
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2020-07-18 11:46:45 +02:00
|
|
|
# END OF SCRIPT
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-09-19 08:33:36 +02:00
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|