From 161971e34c93d70589815214ba82463cff7fe261 Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 31 Oct 2022 22:24:46 +0100 Subject: [PATCH] set app as owner of log folder This fix problem of writing log from php actualize_script runed by cron. Issue #148 --- scripts/install | 4 +++- scripts/restore | 4 +++- scripts/upgrade | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 567d0a1..109500b 100755 --- a/scripts/install +++ b/scripts/install @@ -145,7 +145,9 @@ chmod 644 "/etc/cron.d/$app" #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 -mkdir -p "/var/log/$app" +log_path="/var/log/$app" +mkdir -p $log_path +chown $app:www-data $log_path # Use logrotate to manage application logfile(s) ynh_use_logrotate diff --git a/scripts/restore b/scripts/restore index 1f98301..640fb9c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -108,7 +108,9 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 -mkdir -p "/var/log/$app" +log_path="/var/log/$app" +mkdir -p $log_path +chown $app:www-data $log_path ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6e16b9f..c018a2a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -167,7 +167,9 @@ fi #================================================= ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 -mkdir -p "/var/log/$app" +log_path="/var/log/$app" +mkdir -p $log_path +chown $app:www-data "$log_path" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append