2017-02-06 00:55:47 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Source YNH helpers
|
|
|
|
. /usr/share/yunohost/helpers
|
|
|
|
|
2017-02-07 02:00:31 +01:00
|
|
|
backup_dir=$1
|
|
|
|
|
2017-02-06 00:55:47 +01:00
|
|
|
# Get app instance name
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-02-06 23:50:47 +01:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
path=$(ynh_app_setting_get $app path)
|
|
|
|
local_path=$(ynh_app_setting_get $app local_path)
|
2017-02-06 00:55:47 +01:00
|
|
|
|
2017-02-07 02:00:31 +01:00
|
|
|
my_ynh_backup () {
|
|
|
|
ynh_backup $@
|
|
|
|
echo $2 $1 >> $backup_dir/list
|
|
|
|
}
|
|
|
|
|
2017-02-06 00:55:47 +01:00
|
|
|
# Copy the app files
|
2017-02-07 02:00:31 +01:00
|
|
|
my_ynh_backup "$local_path" "sources"
|
2017-02-06 00:55:47 +01:00
|
|
|
|
|
|
|
# Copy the conf files
|
2017-02-07 02:00:31 +01:00
|
|
|
my_ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|
|
|
|
my_ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "conf/php-fpm.conf"
|
|
|
|
my_ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "conf/php-fpm.ini"
|
2017-02-06 00:55:47 +01:00
|
|
|
|
|
|
|
# Save database
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
|
|
mysqldump -u "$app" -p"$dbpass" --no-create-db "$app" > ./dump.sql
|