From 1b9796fb2b19065defd8f37c180dd89653bce09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 5 Nov 2023 23:09:46 +0100 Subject: [PATCH] Backup and restore the log directory --- scripts/backup | 4 ++++ scripts/restore | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/scripts/backup b/scripts/backup index 0856374..cf5e5c5 100755 --- a/scripts/backup +++ b/scripts/backup @@ -62,6 +62,10 @@ ynh_backup --src_path="/etc/cron.d/$app" ynh_backup --src_path="/etc/$app/" +# For apps with huge logs, you might want to pass --is_big, +# and in restore script, mkdir and pass --not_mandatory to ynh_restore_file. +ynh_backup --src_path="/var/log/$app/" + #================================================= # BACKUP THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index ef219e7..81db80b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -61,6 +61,16 @@ ynh_systemd_action --action=restart --service_name=fail2ban ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/$app/" +# For apps with huge logs, you might want to not backup logs every time: +# The mkdir call is just here in case the log directory was not backed up. +# mkdir -p "/var/log/$app" +# chown $app:www-data "/var/log/$app" +# ynh_restore_file --src_path="/var/log/$app/" --not_mandatory +# +# For other apps, the simple way is better: +ynh_restore_file --origin_path="/var/log/$app/" + + #================================================= # RESTORE THE MYSQL DATABASE #=================================================