2018-02-25 21:45:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Load common variables and helpers
|
|
|
|
source ../settings/scripts/experimental_helper.sh
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Copy the app source files
|
|
|
|
ynh_backup "$final_path"
|
|
|
|
|
|
|
|
# Copy the data files
|
|
|
|
ynh_backup "$DATADIR"
|
|
|
|
|
|
|
|
# Copy the conf files
|
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
|
|
ynh_backup "/etc/systemd/system/${app}.service"
|
|
|
|
|
|
|
|
# Backup logs
|
|
|
|
ynh_backup "/var/log/$app"
|
|
|
|
|
|
|
|
# Dump the database
|
2019-02-22 21:48:50 +01:00
|
|
|
ynh_mysql_dump_db "$dbname" > ./db.sql
|
|
|
|
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP THE DATA DIRECTORY
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
|
|
|
|
# If backup_core_only have any value in the settings.yml file, do not backup the data directory
|
|
|
|
if [ -z $backup_core_only ]
|
|
|
|
then
|
|
|
|
ynh_backup "/home/$app"
|
|
|
|
else
|
|
|
|
echo "Data dir will not be saved, because backup_core_only is set." >&2
|
|
|
|
fi
|