mirror of
https://github.com/YunoHost-Apps/piwigo_ynh.git
synced 2024-09-03 20:06:03 +02:00
30 lines
808 B
Bash
30 lines
808 B
Bash
#!/bin/bash
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
set -eu
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Backup sources & data
|
|
# Note: the last argument is where to save this path, see the restore script.
|
|
ynh_backup "/var/www/${app}" "sources"
|
|
|
|
# Copy the data directory
|
|
DATADIR="/home/yunohost.app/${app}"
|
|
ynh_backup "$DATADIR" "data"
|
|
|
|
# Dump the database
|
|
dbname=$app
|
|
dbuser=$app
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
|
|
|
# Copy NGINX configuration
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
|
|
|
# Copy PHP-FPM pool configuration
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|