2016-05-07 02:14:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
2017-04-16 17:22:30 +02:00
|
|
|
set -eu
|
2016-05-07 02:14:57 +02:00
|
|
|
|
|
|
|
# Source YNH helpers
|
2017-04-16 17:22:30 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-05-07 02:14:57 +02:00
|
|
|
|
|
|
|
# This is a multi-instance app, meaning it can be installed several times independently
|
|
|
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
|
|
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
|
|
# The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
|
|
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
|
|
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
|
|
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
|
|
# The app instance name is probably what you are interested the most, since this is
|
|
|
|
# guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
|
|
# db names, ...
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-04-16 17:22:30 +02:00
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2016-05-07 02:14:57 +02:00
|
|
|
|
|
|
|
# Backup directory location for the app from where the script is executed and
|
|
|
|
# which will be compressed afterward
|
|
|
|
backup_dir=$YNH_APP_BACKUP_DIR
|
|
|
|
|
|
|
|
# Backup sources & data
|
2017-04-16 17:22:30 +02:00
|
|
|
ynh_backup "/var/www/${app}" "sources"
|
2016-05-07 02:14:57 +02:00
|
|
|
|
|
|
|
# Copy Nginx conf
|
|
|
|
sudo mkdir -p ./conf
|
2017-04-16 17:22:30 +02:00
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
|
2017-04-16 23:57:23 +02:00
|
|
|
# Copy the php-fpm conf files
|
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
|
|
|
ynh_backup "/etc/php5/fpm/conf.d/20-${app}.ini" "php-fpm.ini"
|