1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galette_ynh.git synced 2024-09-03 18:36:28 +02:00
galette_ynh/scripts/backup

73 lines
2.3 KiB
Text
Raw Normal View History

2018-03-21 00:04:12 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-09-25 21:04:44 +02:00
source ../settings/scripts/_common.sh
2018-03-21 00:04:12 +01:00
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
2021-01-05 23:31:12 +01:00
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
2018-03-21 00:04:12 +01:00
#=================================================
2021-01-05 23:31:12 +01:00
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
2018-03-21 00:04:12 +01:00
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
2021-01-05 23:31:12 +01:00
ynh_backup --src_path="$final_path"
2018-03-21 00:04:12 +01:00
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
2021-01-05 23:31:12 +01:00
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2018-03-21 00:04:12 +01:00
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
2021-01-05 23:31:12 +01:00
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
2018-03-21 00:04:12 +01:00
#=================================================
2021-07-22 15:15:54 +02:00
# BACKUP THE POSTGRESQL DATABASE
2018-03-21 00:04:12 +01:00
#=================================================
2021-07-22 15:15:54 +02:00
ynh_print_info --message="Backing up the PostgreSQL database..."
2018-03-21 00:04:12 +01:00
2021-07-22 15:15:54 +02:00
ynh_psql_dump_db --database="$db_name" > db.sql
2018-03-21 00:04:12 +01:00
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
2021-01-05 23:31:12 +01:00
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."