From c337193292e74e18be983016377367aac0dfea0c Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Fri, 1 May 2020 14:40:34 +0200 Subject: [PATCH] Fix cron user Lufi has its own user for the web service, it should also use it for the cron it installs --- conf/cron_lufi | 8 ++++---- scripts/install | 1 + scripts/upgrade | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conf/cron_lufi b/conf/cron_lufi index e308733..3da3cc4 100644 --- a/conf/cron_lufi +++ b/conf/cron_lufi @@ -1,11 +1,11 @@ # Génération des statistiques. Tous les jours, à 5h. -0 5 * * * www-data cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron stats +0 5 * * * __USER__ cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron stats # Suppression des adresses IP obsolètes. Tous les jours, à 6h. -0 6 * * * www-data cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron cleanbdd +0 6 * * * __USER__ cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron cleanbdd # Suppression des images dont le délai a expiré. Tous les jours, à 6h. -0 6 * * * www-data cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron cleanfiles +0 6 * * * __USER__ cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron cleanfiles # Vérification de l'occupation du dossier des images. Tous les jours, à 7h. -0 7 * * * www-data cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron watch +0 7 * * * __USER__ cd "__FINALPATH__" && /usr/local/bin/carton exec script/lufi cron watch diff --git a/scripts/install b/scripts/install index d55e7a7..a62c868 100644 --- a/scripts/install +++ b/scripts/install @@ -158,6 +158,7 @@ ynh_store_file_checksum "${final_path}/lufi.conf" cp ../conf/cron_lufi /etc/cron.d/$app ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app" +ynh_replace_string "__USER__" "$app" "/etc/cron.d/$app" chmod +x $final_path/script/lufi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 0699122..c51af70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,6 +147,7 @@ ynh_store_file_checksum "${final_path}/lufi.conf" cp ../conf/cron_lufi /etc/cron.d/$app ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app" +ynh_replace_string "__USER__" "$app" "/etc/cron.d/$app" chmod +x $final_path/script/lufi #=================================================