2016-05-07 18:21:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# MANAGE FAILURE OF THE SCRIPT
|
|
|
|
#=================================================
|
2016-05-07 18:21:06 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
2016-05-07 18:21:06 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-05-07 18:21:06 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
if [ ! -e _common.sh ]; then
|
|
|
|
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
|
|
|
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
|
|
|
sudo chmod a+rx _common.sh
|
|
|
|
fi
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-05-07 18:21:06 +02:00
|
|
|
|
2017-05-01 15:47:20 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Récupère les infos de l'application.
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
# BACKUP OF THE MAIN DIR OF THE APP
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
CHECK_SIZE "$final_path"
|
2017-06-13 15:47:47 +02:00
|
|
|
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path"
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP OF THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
2017-06-13 15:47:47 +02:00
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-05-01 15:47:20 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
|
|
|
# BACKUP OF THE UWSGI CONFIG
|
|
|
|
#=================================================
|
|
|
|
|
2017-06-13 15:47:47 +02:00
|
|
|
ynh_backup "/etc/uwsgi/apps-available/$app.ini" "${YNH_APP_BACKUP_DIR}/etc/uwsgi/apps-available/$app.ini"
|