1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
wallabag2_ynh/scripts/backup
JimboJoe 29ccad06f6 Refactoring, backup/restore, multi-instance (#28)
* Refactoring, backup/restore, multi-instance

* Use dedicated system user, backup before upgrade

* Set directory rights (fixes #31), point to localhost (fixes #29), use up-to-date php-fpm.conf

* Install dependencies when restoring

* Set Wallabag URL in internal settings

* Fix upgrade, use more forthcoming helpers

* fix #32, use latest mysql helpers

* Small fixes (redundant file, up-to-date check_process, syntax correction on app.src)
2017-05-18 15:24:33 +02:00

55 lines
No EOL
1.5 KiB
Bash

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Fetch helpers file if not in current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path="/var/www/${app}"
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP APP MAIN DIR
#=================================================
CHECK_SIZE "$final_path"
ynh_backup "$final_path" "sources"
#=================================================
# BACKUP NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
#=================================================
# BACKUP PHP-FPM CONFIGURATION
#=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "php-fpm.conf"
#=================================================
# BACKUP MYSQL DB
#=================================================
ynh_mysql_dump_db "$db_name" > dump.sql
CHECK_SIZE "dump.sql"
ynh_backup "dump.sql" "db.sql"