From 09e0b5101eba5341466d0fbd104c46f582c8e03e Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Sat, 25 Nov 2023 13:48:36 +0100 Subject: [PATCH] restore: create file for fail2ban if not exist --- scripts/restore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/restore b/scripts/restore index 39a0157..51865cf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,6 +71,12 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Restoring fail2ban configuration..." +# If it doesn't exist, create the logfile, required before configuring fail2ban +log4fail2ban="/var/log/nginx/${domain}-access.log" +if [ ! -f "${log4fail2ban}" ]; then + touch "${log4fail2ban}" +fi + ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban