2016-09-11 10:16:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-02-17 19:28:37 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-09-11 10:16:37 +02:00
|
|
|
|
2019-02-17 19:28:37 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
2016-09-11 10:16:37 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2017-10-17 19:45:45 +02:00
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
2017-09-22 21:18:12 +02:00
|
|
|
final_path=$(ynh_app_setting_get "$app" final_path)
|
2017-06-03 18:13:29 +02:00
|
|
|
db_name=$(ynh_app_setting_get $app db_name)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
|
|
|
|
2017-09-11 22:00:57 +02:00
|
|
|
ynh_backup "$final_path"
|
2016-09-11 10:16:37 +02:00
|
|
|
|
2019-02-17 19:28:37 +01:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-06-03 18:13:29 +02:00
|
|
|
|
2017-06-18 18:24:10 +02:00
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
# BACKUP THE PHP-FPM CONFIGURATION
|
2017-06-18 18:24:10 +02:00
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
|
2017-06-18 18:24:10 +02:00
|
|
|
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
|
|
|
|
2019-02-17 19:28:37 +01:00
|
|
|
ynh_mysql_dump_db "$db_name" > db.sql
|
2017-06-03 18:13:29 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
# BACKUP FAIL2BAN CONFIGURATION
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
2016-09-11 10:16:37 +02:00
|
|
|
|
2017-09-11 22:00:57 +02:00
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
2019-02-17 19:28:37 +01:00
|
|
|
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
|
|
|
|
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
|
2016-09-11 10:16:37 +02:00
|
|
|
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
2019-02-17 19:28:37 +01:00
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
|
|
|
# BACKUP THE DATA DIRECTORY
|
2017-06-03 18:13:29 +02:00
|
|
|
#=================================================
|
2017-02-08 18:32:46 +01:00
|
|
|
|
2019-02-17 19:28:37 +01:00
|
|
|
# The 1 parameter indicates the directory is "big",
|
|
|
|
# so that it won't be backed up before upgrade
|
|
|
|
# This argument has to be the third one.
|
|
|
|
ynh_backup "/home/yunohost.app/${app}/upload" "/home/yunohost.app/${app}/upload" 1
|
|
|
|
|