2018-03-21 00:04:12 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2022-04-13 20:36:45 +02:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
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
|
|
|
|
|
|
|
|
#=================================================
|
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
|
|
|
|
#=================================================
|
|
|
|
|
2023-11-11 14:01:42 +01:00
|
|
|
ynh_backup --src_path="$install_dir"
|
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
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
|
|
|
# BACKUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
|
2021-01-05 23:31:12 +01:00
|
|
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
|
|
|
|
2022-04-14 00:33:50 +02:00
|
|
|
#=================================================
|
2022-04-18 20:10:22 +02:00
|
|
|
# BACKUP THE SQL DATABASE
|
2022-04-14 00:33:50 +02:00
|
|
|
#=================================================
|
2023-11-16 19:59:44 +01:00
|
|
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
2022-04-14 00:33:50 +02:00
|
|
|
|
2023-11-16 19:59:44 +01:00
|
|
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
2022-04-14 00:33:50 +02:00
|
|
|
|
2021-01-05 23:31:12 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|