public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [PATCH pmg-api v5 01/11] pmgpolicy: move pid file into /run/pmgpolicy
@ 2025-04-04 13:14 Maximiliano Sandoval
  2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 02/11] pmg-smtp-filter: move pid file into /run/pmg-smtp-filter Maximiliano Sandoval
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2025-04-04 13:14 UTC (permalink / raw)
  To: pmg-devel

We use systemd's RuntimeDirectory to ensure the directory exists when needed.

We also set $opt_pidfile using PIDFILE, see
https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24PIDFILE.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

Differences from v4:
 - Run pmg-smtp-filter migration if coming from a version older than 9.0.0.
 - Instead of adding the pmgpolicy user to the pmg group, pmgproxy.service is
   started with SupplementaryGroups=systemd-journal
 - Use $ENV{'PIDFILE'} instead of hardcoding PID path on binaries backed up
   with a systemd service

Differences from v3:
 - Override rrdcached's systemd unit to add SOCKGROUP=pmg instead of
   modifying /etc/default/rrdcached.conf

Differences from v2:
 - Use systemd-sysusers for creating users

 debian/pmgpolicy.service | 3 ++-
 src/bin/pmgpolicy        | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/pmgpolicy.service b/debian/pmgpolicy.service
index 517a5d61..21a403f0 100644
--- a/debian/pmgpolicy.service
+++ b/debian/pmgpolicy.service
@@ -10,8 +10,9 @@ ExecStart=/usr/bin/pmgpolicy
 KillMode=mixed
 TimeoutStopSec=40
 ExecReload=/bin/kill -HUP $MAINPID
-PIDFile=/run/pmgpolicy.pid
+PIDFile=/run/pmgpolicy/pmgpolicy.pid
 Type=forking
+RuntimeDirectory=pmgpolicy
 
 [Install]
 WantedBy=multi-user.target
diff --git a/src/bin/pmgpolicy b/src/bin/pmgpolicy
index df2e66f4..3f976ff7 100755
--- a/src/bin/pmgpolicy
+++ b/src/bin/pmgpolicy
@@ -56,7 +56,7 @@ if (!GetOptions(%_opts)) {
     exit (-1);
 }
 
-$opt_pidfile = "/run/pmgpolicy.pid" if !$opt_pidfile;
+$opt_pidfile = $ENV{'PIDFILE'} if !$opt_pidfile;
 $opt_max_dequeue = 0 if $opt_testmode;
 
 initlog('pmgpolicy', 'mail');
-- 
2.39.5



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-04-04 13:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-04 13:14 [pmg-devel] [PATCH pmg-api v5 01/11] pmgpolicy: move pid file into /run/pmgpolicy Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 02/11] pmg-smtp-filter: move pid file into /run/pmg-smtp-filter Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 03/11] config: store config lock in smtp-filter runtime dir Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 04/11] create new users for the rule db Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 05/11] postinstall: add new group for shared functionality Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 06/11] postinstall: make rrdcached be readable by the pmg group Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 07/11] spamasassin: store files in dir managed by pmg Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 08/11] mailqueue: make mail queue writable by pmg group Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 09/11] d/sysusers: add users for pmgpolicy and smtp-filter Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 10/11] pmgpolicy: set SumplementaryGroups=systemd-journal Maximiliano Sandoval
2025-04-04 13:14 ` [pmg-devel] [PATCH pmg-api v5 11/11] fix #4926: run pmg-smtp-filter and pmgpolicy without root rights Maximiliano Sandoval

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal