2016-03-23 19:30:43 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
2016-09-05 21:11:16 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
2016-05-23 21:40:55 +02:00
|
|
|
|
2016-09-05 21:11:16 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2016-05-23 21:40:55 +02:00
|
|
|
|
|
|
|
# retrieve arguments
|
2016-09-05 21:11:16 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2016-03-23 19:30:43 +01:00
|
|
|
|
2016-04-04 20:01:54 +02:00
|
|
|
# definie useful vars
|
|
|
|
parent_path=/var/www
|
|
|
|
final_path=$parent_path/$app
|
2016-04-05 20:03:26 +02:00
|
|
|
data_path=/home/yunohost.app/$app
|
2016-04-04 20:01:54 +02:00
|
|
|
|
2016-04-05 20:03:26 +02:00
|
|
|
# backup sources & data
|
2016-09-05 21:11:16 +02:00
|
|
|
ynh_backup "$final_path" "www"
|
|
|
|
ynh_backup "$data_path" "data"
|
2016-03-23 19:30:43 +01:00
|
|
|
|
2016-09-05 21:11:16 +02:00
|
|
|
# backup Nginx and php-fpm
|
|
|
|
mkdir ./conf
|
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
|
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf"
|