2017-04-24 04:16:02 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-02 16:58:08 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ ! -e _common.sh ]; then
|
|
|
|
# Get the _common.sh file if it's not in the current directory
|
|
|
|
cp ../settings/scripts/_common.sh ./_common.sh
|
|
|
|
chmod a+rx _common.sh
|
|
|
|
fi
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2017-04-24 04:16:02 +02:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
|
|
|
|
# Backup sources & data
|
2018-02-02 16:58:08 +01:00
|
|
|
ynh_backup "/var/www/${app}" "sources"
|
2017-04-24 04:16:02 +02:00
|
|
|
|
|
|
|
# MySQL
|
2018-02-02 16:58:08 +01:00
|
|
|
dbname=$app
|
|
|
|
dbuser=$app
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
|
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
2017-04-24 04:16:02 +02:00
|
|
|
|
|
|
|
# Copy NGINX configuration
|
2018-02-02 16:58:08 +01:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
2017-04-24 04:16:02 +02:00
|
|
|
|
|
|
|
# PHP
|
2018-02-02 16:58:08 +01:00
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|