2019-02-23 11:06:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-05-30 19:18:05 +02:00
|
|
|
ynh_print_info --message="Loading installation settings..."
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2020-05-27 18:18:11 +02:00
|
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
2021-08-02 08:23:59 +02:00
|
|
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2020-05-30 19:18:05 +02:00
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
2020-05-30 19:18:05 +02:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2020-05-30 19:18:05 +02:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
|
|
|
|
2020-05-30 19:18:05 +02:00
|
|
|
ynh_backup --src_path="$final_path"
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-11-23 08:28:18 +01:00
|
|
|
# BACKUP DATADIR
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
|
|
|
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_backup --src_path="$datadir" --is_big
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-11-23 08:28:18 +01:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
|
|
|
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2019-02-23 11:06:32 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-11-23 08:28:18 +01:00
|
|
|
# BACKUP SYSTEMD
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
2019-10-25 11:04:41 +02:00
|
|
|
|
2021-11-23 08:28:18 +01:00
|
|
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
2019-10-25 11:04:41 +02:00
|
|
|
|
2019-02-23 11:06:32 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-05-27 17:03:30 +02:00
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|