[pmg-devel] [PATCH pmg-api v3 01/10] pmgpolicy: move pid file into /run/pmgpolicy
Maximiliano Sandoval
m.sandoval at proxmox.com
Mon Jun 17 16:17:58 CEST 2024
We use systemd's RuntimeDirectory to ensure the directory exists when needed.
Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
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 517a5d6..21a403f 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 df2e66f..51a03d1 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 = "/run/pmgpolicy/pmgpolicy.pid" if !$opt_pidfile;
$opt_max_dequeue = 0 if $opt_testmode;
initlog('pmgpolicy', 'mail');
--
2.39.2
More information about the pmg-devel
mailing list