1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00
ttrss_ynh/scripts/backup

68 lines
2.2 KiB
Text
Raw Normal View History

2016-01-10 20:10:16 +01:00
#!/bin/bash
2017-08-27 14:42:28 +02:00
#=================================================
# GENERIC START
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit on command errors and treat access to unset variables as an error
set -eu
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-08-27 15:34:30 +02:00
# if [ ! -e _common.sh ]; then
# # Get the _common.sh file if it's not in the current directory
# cp ../settings/scripts/_common.sh ./_common.sh
# chmod a+rx _common.sh
# fi
# source _common.sh
2017-08-27 14:42:28 +02:00
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2016-05-10 15:51:32 +02:00
app=$YNH_APP_INSTANCE_NAME
2016-01-10 20:10:16 +01:00
2017-08-27 14:42:28 +02:00
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$final_path" "${YNH_APP_BACKUP_DIR}$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "${YNH_APP_BACKUP_DIR}/etc/php5/fpm/conf.d/20-$app.ini"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
2016-01-10 20:10:16 +01:00
2017-08-27 14:42:28 +02:00
ynh_mysql_dump_db "$db_name" > db.sql
2016-01-10 20:10:16 +01:00
2017-08-27 14:42:28 +02:00
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP SYSTEMD
2017-08-27 14:42:28 +02:00
#=================================================
2016-01-10 20:10:16 +01:00
ynh_backup "/etc/systemd/system/$app.service" "${YNH_APP_BACKUP_DIR}/etc/systemd/system/$app.service"