1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/flohmarkt_ynh.git synced 2024-09-03 18:36:30 +02:00

backup script

This commit is contained in:
Chris Vogel 2024-04-20 15:53:19 +02:00
parent c34ed46550
commit 97ea2fcc43

View file

@ -1,55 +1,26 @@
#!/bin/bash #!/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 ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir" ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
#================================================= # ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= # for the following backups we'll want to stop flohmarkt and couchdb
# END OF SCRIPT # to guarentee a consistant state
#================================================= ynh_print_info --message="Stopping flohmarkt and couchdb to backup data..."
yunohost service stop flohmarkt
systemctl stop couchdb
ynh_backup --src_path="$data_dir" --is_big
ynh_backup --src_path="/var/lib/couchdb" --is_big
ynh_print_info --message="...done. Starting couchdb and flohmarkt."
systemctl start couchdb
yunohost service start flohmarkt
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."