2017-02-06 00:55:47 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# GENERIC START
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
|
|
source ../settings/scripts/_common.sh
|
2018-03-13 21:49:11 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
2017-02-06 00:55:47 +01:00
|
|
|
|
2021-07-12 12:11:43 +02:00
|
|
|
#=================================================
|
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2018-03-13 21:49:11 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# BACKUP THE APP MAIN DIR
|
|
|
|
#=================================================
|
|
|
|
|
2024-01-23 16:40:33 +01:00
|
|
|
ynh_backup --src_path="$install_dir"
|
2021-07-12 12:11:43 +02:00
|
|
|
|
2022-06-15 23:45:27 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE DATA DIR
|
|
|
|
#=================================================
|
|
|
|
|
2024-01-23 16:40:33 +01:00
|
|
|
ynh_backup --src_path="$data_dir" --is_big
|
2022-06-15 23:45:27 +02:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
|
2021-07-12 12:11:43 +02:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2018-03-13 21:49:11 +01:00
|
|
|
|
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# BACKUP THE PHP-FPM CONFIGURATION
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
|
|
|
|
2021-07-12 12:11:43 +02:00
|
|
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
2017-02-06 00:55:47 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
ynh_print_info --message="Backing up the MySQL database..."
|
2017-02-07 02:00:31 +01:00
|
|
|
|
2021-07-12 12:11:43 +02:00
|
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
2017-02-06 00:55:47 +01:00
|
|
|
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2021-07-12 12:11:43 +02:00
|
|
|
# END OF SCRIPT
|
2018-03-13 21:49:11 +01:00
|
|
|
#=================================================
|
2017-02-06 00:55:47 +01:00
|
|
|
|
2021-07-12 12:11:43 +02:00
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|