my_idlers_ynh/scripts/backup
2025-03-02 21:27:39 +01:00

49 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
ynh_print_info "Declaring files to be backed up..."
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fills the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls take basically 0 seconds to run.
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$install_dir"
#=================================================
# BACKUP SYSTEM CONFIGURATION
#=================================================
# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Backup the Fail2Ban config
#ynh_backup "/etc/fail2ban/jail.d/$app.conf"
#ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info "Backing up the MySQL database..."
### (However, things like MySQL dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)
ynh_mysql_dump_db > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."