2016-11-29 00:20:02 +01:00
|
|
|
#!/bin/bash
|
2016-07-05 15:22:12 +02:00
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
|
2017-05-18 23:28:18 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#source _future.sh
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
|
2016-07-05 15:22:12 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2017-05-18 23:28:18 +02:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2018-12-14 03:36:58 +01:00
|
|
|
final_path=$(ynh_app_setting_get "$app" final_path)
|
2016-07-05 15:22:12 +02:00
|
|
|
|
|
|
|
# Backup sources & data
|
2018-12-14 03:36:58 +01:00
|
|
|
ynh_backup "${final_path}/$APPNAME"
|
|
|
|
ynh_backup "${final_path}/custom-addons"
|
|
|
|
ynh_backup "${final_path}/.local"
|
2017-05-18 23:28:18 +02:00
|
|
|
|
|
|
|
# Backup configuration
|
2018-12-14 03:36:58 +01:00
|
|
|
ynh_backup "$conf_file"
|
2016-07-05 15:22:12 +02:00
|
|
|
|
|
|
|
# Copy NGINX configuration
|
2018-12-14 03:36:58 +01:00
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
2017-05-18 23:28:18 +02:00
|
|
|
|
2016-07-05 15:22:12 +02:00
|
|
|
# Copy database
|
2018-12-14 03:36:58 +01:00
|
|
|
sudo su -c "pg_dump $app" postgres > ./dump.sql
|