2016-03-28 22:14:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-05-15 17:26:39 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# Get multi-instances specific variables
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-03-28 22:14:19 +02:00
|
|
|
|
|
|
|
# Source app helpers
|
|
|
|
. /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Retrieve app settings
|
2016-05-15 17:26:39 +02:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
path=$(ynh_app_setting_get "$app" path)
|
2017-06-02 17:15:57 +02:00
|
|
|
with_carddav=$(ynh_app_setting_get "$app" with_carddav)
|
2016-05-15 17:26:39 +02:00
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
2017-06-02 17:15:57 +02:00
|
|
|
dbname=$app
|
|
|
|
dbuser=$app
|
2016-03-28 22:14:19 +02:00
|
|
|
|
|
|
|
# Copy the app files
|
2017-06-02 17:15:57 +02:00
|
|
|
finalpath="/var/www/$app"
|
|
|
|
ynh_backup "$finalpath" "sources"
|
2016-03-28 22:14:19 +02:00
|
|
|
|
2017-06-17 23:26:47 +02:00
|
|
|
# Copy the nginx conf files
|
2016-05-07 02:11:39 +02:00
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
2017-06-17 23:26:47 +02:00
|
|
|
# Copy the php-fpm conf files
|
2016-05-07 02:11:39 +02:00
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
2017-06-17 23:26:47 +02:00
|
|
|
ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "php-fpm.ini"
|
2016-03-28 22:14:19 +02:00
|
|
|
|
|
|
|
# Dump the database
|
|
|
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|