From 17fc3def1846ab31048eeef713fb07ec9fd5a12f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 25 Apr 2020 16:50:32 +0200 Subject: [PATCH 1/5] systemd service type should be "forking" ? --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index a8b2a68..8cc58b2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,7 +5,7 @@ Requires=network.target After=network.target [Service] -Type=simple +Type=forking User=__APP__ Group=__APP__ RemainAfterExit=yes From 3b0983a08400fe49e325c3dbfb3c53550b9f00b7 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Sat, 25 Apr 2020 21:10:43 +0200 Subject: [PATCH 2/5] Fix pid file path --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index a8b2a68..72a6a57 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -10,7 +10,7 @@ User=__APP__ Group=__APP__ RemainAfterExit=yes WorkingDirectory=__FINALPATH__ -PIDFile=__FINALPATH__script/hypnotoad.pid +PIDFile=__FINALPATH__/script/hypnotoad.pid ExecStart=/usr/local/bin/carton exec hypnotoad script/lufi ExecStop=/usr/local/bin/carton exec hypnotoad -s script/lufi ExecReload=/usr/local/bin/carton exec hypnotoad script/lufi From 22b6072178ecec9bedcc6d7510f9df2e0848257d Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Sun, 26 Apr 2020 21:17:36 +0200 Subject: [PATCH 3/5] Remove RemainAfterExit in systemd unit RemainAfterExit means that the service should be considered active even when all its children has terminated. This is not what we want here as the child process created by carton is a daemon process and not expected to terminate. Also, on stretch, the return code of the child process has no influence on the status of the service if RemainAfterExit is set. --- conf/systemd.service | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 8cc58b2..f66c471 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,6 @@ After=network.target Type=forking User=__APP__ Group=__APP__ -RemainAfterExit=yes WorkingDirectory=__FINALPATH__ PIDFile=__FINALPATH__script/hypnotoad.pid ExecStart=/usr/local/bin/carton exec hypnotoad script/lufi From c337193292e74e18be983016377367aac0dfea0c Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Fri, 1 May 2020 14:40:34 +0200 Subject: [PATCH 4/5] 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 #================================================= From 07d007dcbdccc461dd43a325762c3312b4f60391 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 21 May 2020 11:11:32 +0200 Subject: [PATCH 5/5] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index b9dff0c..8585e3e 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "en": "Self hosting files and sharing anonymous application", "fr": "Application d'hébergement et de partage de fichiers anonyme" }, - "version": "0.03.5~ynh1", + "version": "0.03.5~ynh2", "url": "https://git.framasoft.org/luc/lufi", "license": "AGPL-3.0-or-later", "maintainer": { @@ -62,4 +62,4 @@ } ] } -} \ No newline at end of file +}