2021-09-18 14:27:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP THE APP MAIN DIR
|
|
|
|
#=================================================
|
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
ynh_backup --src_path="$install_dir"
|
2021-09-18 14:27:12 +02:00
|
|
|
|
2021-09-18 14:36:33 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE DATA DIR
|
|
|
|
#=================================================
|
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
ynh_backup --src_path="$data_dir" --is_big
|
2021-09-18 14:36:33 +02:00
|
|
|
|
2021-09-18 14:27:12 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|
|
|
|
|
|
|
#=================================================
|
2021-09-18 14:36:33 +02:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2021-09-18 14:27:12 +02:00
|
|
|
#=================================================
|
2021-09-18 14:36:33 +02:00
|
|
|
ynh_print_info --message="Backing up the MySQL database..."
|
2021-09-18 14:27:12 +02:00
|
|
|
|
2021-09-18 14:36:33 +02:00
|
|
|
ynh_mysql_dump_db --database="$db_name" > db.sql
|
2021-09-18 14:27:12 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-03-27 10:52:28 +02:00
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|