2016-03-18 18:38:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
2022-01-14 23:57:33 +01:00
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2022-01-14 23:57:33 +01:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-11-17 23:55:57 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
2018-08-14 22:18:22 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-03-18 18:38:54 +01:00
|
|
|
|
2018-08-14 22:18:22 +02:00
|
|
|
#=================================================
|
2022-01-14 23:57:33 +01:00
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
2020-12-06 21:39:09 +01:00
|
|
|
#=================================================
|
2022-01-14 23:57:33 +01:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2018-08-14 22:18:22 +02:00
|
|
|
|
2022-01-14 23:57:33 +01:00
|
|
|
#=================================================
|
2024-01-30 23:33:35 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2022-01-14 23:57:33 +01:00
|
|
|
#=================================================
|
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
# Backup the nginx configuration
|
2022-01-14 23:57:33 +01:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-30 23:33:35 +01:00
|
|
|
# BACKUP VARIOUS FILES
|
2022-01-14 23:57:33 +01:00
|
|
|
#=================================================
|
2020-12-06 21:39:09 +01:00
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
# Backup SOGo configuration
|
2022-01-14 23:57:33 +01:00
|
|
|
ynh_backup --src_path="/etc/$app"
|
2020-12-06 21:39:09 +01:00
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
# Backup cron
|
2022-01-14 23:57:33 +01:00
|
|
|
ynh_backup --src_path="/etc/cron.d/$app"
|
2019-06-07 23:09:30 +02:00
|
|
|
|
2024-01-30 23:33:35 +01:00
|
|
|
# Backup logs
|
2022-01-14 23:57:33 +01:00
|
|
|
ynh_backup --src_path="/var/log/$app"
|
|
|
|
|
|
|
|
#=================================================
|
2018-08-14 22:18:22 +02:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2022-01-14 23:57:33 +01:00
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Backing up the MySQL database..."
|
|
|
|
|
|
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-06-07 23:09:30 +02:00
|
|
|
|
2020-12-06 21:39:09 +01:00
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|