2017-11-14 16:05:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Import common cmd
|
2018-01-31 16:08:58 +01:00
|
|
|
source ../settings/scripts/experimental_helper.sh
|
2017-11-16 21:10:21 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
2017-11-14 16:05:26 +01:00
|
|
|
|
|
|
|
# LOAD SETTINGS
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
|
2017-11-14 16:05:26 +01:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Backing up the main app directory..."
|
|
|
|
ynh_backup --src_path "$final_path" --is_big
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
# Backup config
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Backing configuration..."
|
|
|
|
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
ynh_backup --src_path "/etc/uwsgi/apps-available/$app.ini"
|
|
|
|
ynh_backup --src_path "/etc/systemd/system/uwsgi-app@.service"
|
2017-11-14 16:05:26 +01:00
|
|
|
|
2017-11-16 21:10:21 +01:00
|
|
|
# Backup Data and LOG
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Backing up synapse data..."
|
|
|
|
ynh_backup --src_path "/var/lib/pgadmin"
|
|
|
|
ynh_script_progression --message="Backing up synapse log..."
|
|
|
|
ynh_backup --src_path "/var/log/pgadmin"
|
|
|
|
ynh_backup --src_path "/var/log/uwsgi/$app"
|
|
|
|
|
|
|
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
|
|
|
|