From dec8d0820fb46e984b2ca65e1012f5f737861965 Mon Sep 17 00:00:00 2001 From: maniack Date: Thu, 2 Jan 2020 18:43:40 +0100 Subject: [PATCH] Fix cron tasks --- conf/cron_lutim | 8 ++++---- scripts/actions/check_quota | 2 +- scripts/actions/clean_images | 2 +- scripts/actions/clean_ip | 2 +- scripts/install | 1 + scripts/upgrade | 1 + 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/conf/cron_lutim b/conf/cron_lutim index bba1a65..f96f975 100644 --- a/conf/cron_lutim +++ b/conf/cron_lutim @@ -1,11 +1,11 @@ # Génération des statistiques. Tous les jours, à 5h. -0 5 * * * www-data cd "__FINALPATH__" && $(which carton) exec script/lutim cron stats +0 5 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron stats # Suppression des adresses IP obsolètes. Tous les jours, à 6h. -0 6 * * * www-data cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanbdd +0 6 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanbdd # Suppression des images dont le délai a expiré. Tous les jours, à 6h. -0 6 * * * www-data cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanfiles +0 6 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron cleanfiles # Vérification de l'occupation du dossier des images. Tous les jours, à 7h. -0 7 * * * www-data cd "__FINALPATH__" && $(which carton) exec script/lutim cron watch +0 7 * * * __APP__ cd "__FINALPATH__" && $(which carton) exec script/lutim cron watch diff --git a/scripts/actions/check_quota b/scripts/actions/check_quota index 884cbe5..bd5d58b 100755 --- a/scripts/actions/check_quota +++ b/scripts/actions/check_quota @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Checking the disk quota for images stored by lutim..." --weight=9 -(cd "$final_path" && $(which carton) exec script/lutim cron watch) +(cd "$final_path" && exec_as $app $(which carton) exec script/lutim cron watch) #================================================= # END OF SCRIPT diff --git a/scripts/actions/clean_images b/scripts/actions/clean_images index bd833d0..b671415 100755 --- a/scripts/actions/clean_images +++ b/scripts/actions/clean_images @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Removing expired images..." --weight=9 -(cd "$final_path" && $(which carton) exec script/lutim cron cleanfiles) +(cd "$final_path" && exec_as $app $(which carton) exec script/lutim cron cleanfiles) #================================================= # END OF SCRIPT diff --git a/scripts/actions/clean_ip b/scripts/actions/clean_ip index 80b990c..8e7db98 100755 --- a/scripts/actions/clean_ip +++ b/scripts/actions/clean_ip @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Removing obsolete ip from the database..." --weight=9 -(cd "$final_path" && $(which carton) exec script/lutim cron cleanbdd) +(cd "$final_path" && exec_as $app $(which carton) exec script/lutim cron cleanbdd) #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 55f3b12..217b5c3 100644 --- a/scripts/install +++ b/scripts/install @@ -135,6 +135,7 @@ ynh_add_systemd_config cp ../conf/cron_lutim /etc/cron.d/$app ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file=/etc/cron.d/$app +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/etc/cron.d/$app chmod +x $final_path/script/lutim #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1bde983..e5b1313 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -223,6 +223,7 @@ fi cp ../conf/cron_lutim /etc/cron.d/$app ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file=/etc/cron.d/$app +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/etc/cron.d/$app #================================================= # UPDATE LUTIM WITH CARTON