1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/crabfit_ynh.git synced 2024-09-03 18:16:21 +02:00
crabfit_ynh/scripts/backup

66 lines
2.4 KiB
Text
Raw Normal View History

2023-08-17 21:45:58 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# 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
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="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 fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.target"
ynh_backup --src_path="/etc/systemd/system/${app}-front.service"
ynh_backup --src_path="/etc/systemd/system/${app}-back.service"
2023-08-17 21:45:58 +02:00
#=================================================
# BACKUP THE POSTGRES DATABASE
2023-08-17 21:45:58 +02:00
#=================================================
ynh_print_info --message="Backing up the POSTGRES database..."
2023-08-17 21:45:58 +02:00
### (However, things like Postgres dumps *do* take some time to run, though the
2023-08-17 21:45:58 +02:00
### copy of the generated dump to the archive still happens later)
ynh_psql_dump_db --database="$db_name" > db.sql
2023-08-17 21:45:58 +02:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."