#!/bin/bash set -eu # exit on error ; treat unset variables as error #================================================= # IMPORT GENERIC HELPERS #================================================= source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= app=$YNH_APP_INSTANCE_NAME final_path="/var/www/$app" domain=$(ynh_app_setting_get $app domain) db_name="$app" default_backup_dir="${1}apps/$app" backup_dir=${backup_dir:-"$default_backup_dir"} #================================================= # STANDARD BACKUP STEPS #================================================= # BACKUP THE APP MAIN DIR #================================================= ynh_backup "$final_path" "${backup_dir}$final_path" #================================================= # BACKUP THE DATABASE #================================================= ynh_mysql_dump_db "$db_name" > db.sql ynh_backup "db.sql" "${backup_dir}/db.sql" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP SUPERVISOR CONFIG #================================================= ynh_backup "/etc/supervisor/conf.d/$app.conf" "${backup_dir}/etc/supervisor/conf.d/$app.conf"