[pmg-devel] [RFC pmg-api 5/5] replace /var/run with /run

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 29 14:45:12 CEST 2019


since the former has been a symlink to the latter since forever.

systemd >= Buster will print lots of noisy messages regarding outdated
PIDFile paths if they point to /var/run.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
there are a few occurences of /var/run left that might also be okay to
change?

 debian/pmg-smtp-filter.service | 2 +-
 debian/pmgdaemon.service       | 2 +-
 debian/pmgmirror.service       | 2 +-
 debian/pmgpolicy.service       | 2 +-
 debian/pmgproxy.service        | 2 +-
 debian/pmgtunnel.service       | 2 +-
 src/PMG/DBTools.pm             | 6 +++---
 src/PMG/Service/pmgmirror.pm   | 2 +-
 src/PMG/Service/pmgproxy.pm    | 2 +-
 src/PMG/Service/pmgtunnel.pm   | 2 +-
 src/bin/pmg-smtp-filter        | 4 ++--
 src/bin/pmgpolicy              | 4 ++--
 src/bin/pmgproxy               | 2 +-
 13 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/debian/pmg-smtp-filter.service b/debian/pmg-smtp-filter.service
index 6ccc5a6..cbf2d6f 100644
--- a/debian/pmg-smtp-filter.service
+++ b/debian/pmg-smtp-filter.service
@@ -11,7 +11,7 @@ ExecStart=/usr/bin/pmg-smtp-filter
 KillMode=mixed
 TimeoutStopSec=40
 ExecReload=/bin/kill -HUP $MAINPID
-PIDFile=/var/run/pmg-smtp-filter.pid
+PIDFile=/run/pmg-smtp-filter.pid
 Type=forking
 Restart=on-abort
 RestartSec=10
diff --git a/debian/pmgdaemon.service b/debian/pmgdaemon.service
index 806cd1f..230f4a7 100644
--- a/debian/pmgdaemon.service
+++ b/debian/pmgdaemon.service
@@ -10,7 +10,7 @@ After=remote-fs.target
 ExecStart=/usr/bin/pmgdaemon start
 ExecStop=/usr/bin/pmgdaemon stop
 ExecReload=/usr/bin/pmgdaemon restart
-PIDFile=/var/run/pmgdaemon.pid
+PIDFile=/run/pmgdaemon.pid
 Type=forking
 
 [Install]
diff --git a/debian/pmgmirror.service b/debian/pmgmirror.service
index 3efca21..fe767ff 100644
--- a/debian/pmgmirror.service
+++ b/debian/pmgmirror.service
@@ -12,7 +12,7 @@ After=pmgtunnel.target
 ExecStart=/usr/bin/pmgmirror start
 ExecStop=/usr/bin/pmgmirror stop
 ExecReload=/usr/bin/pmgmirror restart
-PIDFile=/var/run/pmgmirror.pid
+PIDFile=/run/pmgmirror.pid
 Type=forking
 
 [Install]
diff --git a/debian/pmgpolicy.service b/debian/pmgpolicy.service
index 0f76af9..517a5d6 100644
--- a/debian/pmgpolicy.service
+++ b/debian/pmgpolicy.service
@@ -10,7 +10,7 @@ ExecStart=/usr/bin/pmgpolicy
 KillMode=mixed
 TimeoutStopSec=40
 ExecReload=/bin/kill -HUP $MAINPID
-PIDFile=/var/run/pmgpolicy.pid
+PIDFile=/run/pmgpolicy.pid
 Type=forking
 
 [Install]
diff --git a/debian/pmgproxy.service b/debian/pmgproxy.service
index 06867a0..7a711b3 100644
--- a/debian/pmgproxy.service
+++ b/debian/pmgproxy.service
@@ -12,7 +12,7 @@ After=remote-fs.target
 ExecStart=/usr/bin/pmgproxy start
 ExecStop=/usr/bin/pmgproxy stop
 ExecReload=/usr/bin/pmgproxy restart
-PIDFile=/var/run/pmgproxy/pmgproxy.pid
+PIDFile=/run/pmgproxy/pmgproxy.pid
 Type=forking
 
 [Install]
diff --git a/debian/pmgtunnel.service b/debian/pmgtunnel.service
index febf91d..765073f 100644
--- a/debian/pmgtunnel.service
+++ b/debian/pmgtunnel.service
@@ -11,7 +11,7 @@ After=remote-fs.target
 ExecStart=/usr/bin/pmgtunnel start
 ExecStop=/usr/bin/pmgtunnel stop
 ExecReload=/usr/bin/pmgtunnel restart
-PIDFile=/var/run/pmgtunnel.pid
+PIDFile=/run/pmgtunnel.pid
 Type=forking
 
 [Install]
diff --git a/src/PMG/DBTools.pm b/src/PMG/DBTools.pm
index 464b013..a01f07c 100644
--- a/src/PMG/DBTools.pm
+++ b/src/PMG/DBTools.pm
@@ -39,9 +39,9 @@ sub open_ruledb {
 
     if ($host) {
 
-	# Note: pmgtunnel uses UDP sockets inside directory '/var/run/pmgtunnel',
+	# Note: pmgtunnel uses UDP sockets inside directory '/run/pmgtunnel',
 	# and the cluster 'cid' as port number. You can connect to the
-	# socket with: host => /var/run/pmgtunnel, port => $cid
+	# socket with: host => /run/pmgtunnel, port => $cid
 
 	my $dsn = "dbi:Pg:dbname=$database;host=$host;port=$port;";
 
@@ -1275,7 +1275,7 @@ sub reload_ruledb {
 	}
     }
 
-    my $pid_file = '/var/run/pmg-smtp-filter.pid';
+    my $pid_file = '/run/pmg-smtp-filter.pid';
     my $pid = PVE::Tools::file_read_firstline($pid_file);
 
     return 0 if !$pid;
diff --git a/src/PMG/Service/pmgmirror.pm b/src/PMG/Service/pmgmirror.pm
index f2cb035..339bf7b 100644
--- a/src/PMG/Service/pmgmirror.pm
+++ b/src/PMG/Service/pmgmirror.pm
@@ -121,7 +121,7 @@ sub cluster_sync {
 
 	my $rdb;
 	eval {
-	    $rdb = PMG::DBTools::open_ruledb(undef, '/var/run/pmgtunnel', $ni->{cid});
+	    $rdb = PMG::DBTools::open_ruledb(undef, '/run/pmgtunnel', $ni->{cid});
 	    sync_data_from_node($dbh, $rdb, $cinfo, $ni, $ticket, \$rsynctime);
 	};
 	my $err = $@;
diff --git a/src/PMG/Service/pmgproxy.pm b/src/PMG/Service/pmgproxy.pm
index 4263f39..9e3ed3d 100755
--- a/src/PMG/Service/pmgproxy.pm
+++ b/src/PMG/Service/pmgproxy.pm
@@ -35,7 +35,7 @@ my %daemon_options = (
     leave_children_open_on_reload => 1,
     setuid => 'www-data',
     setgid => 'www-data',
-    pidfile => '/var/run/pmgproxy/pmgproxy.pid',
+    pidfile => '/run/pmgproxy/pmgproxy.pid',
 );
 
 my $daemon = __PACKAGE__->new('pmgproxy', $cmdline, %daemon_options);
diff --git a/src/PMG/Service/pmgtunnel.pm b/src/PMG/Service/pmgtunnel.pm
index 4b8d16a..a556028 100644
--- a/src/PMG/Service/pmgtunnel.pm
+++ b/src/PMG/Service/pmgtunnel.pm
@@ -35,7 +35,7 @@ my $workers = {};
 my $delayed_exec = {};
 my $startcount = {};
 
-my $socketdir = "/var/run/pmgtunnel";
+my $socketdir = "/run/pmgtunnel";
 
 my $socketfile = sub {
     my ($cid) = @_;
diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 59d6ecb..61eaf92 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -72,7 +72,7 @@ if (!GetOptions ('testmode=s' => \$opt_testmode,
     exit (-1);
 }
 
-$opt_pidfile = "/var/run/${prog_name}.pid" if !$opt_pidfile;
+$opt_pidfile = "/run/${prog_name}.pid" if !$opt_pidfile;
 
 my $max_servers = 1;
 my $min_servers = 1;
@@ -889,7 +889,7 @@ sub process_request {
   $self->done (1) if $err;
 }
 
-# test sig_hup with: for ((;;)) ;do kill -HUP  `cat /var/run/${prog_name}.pid`; done;
+# test sig_hup with: for ((;;)) ;do kill -HUP  `cat /run/${prog_name}.pid`; done;
 # wrapper to avoid multiple calls to sig_hup
 sub sig_hup {
   my $self = shift;
diff --git a/src/bin/pmgpolicy b/src/bin/pmgpolicy
index 9696629..59d28f7 100755
--- a/src/bin/pmgpolicy
+++ b/src/bin/pmgpolicy
@@ -52,7 +52,7 @@ if (!GetOptions(%_opts)) {
     exit (-1);
 }
 
-$opt_pidfile = "/var/run/pmgpolicy.pid" if !$opt_pidfile;
+$opt_pidfile = "/run/pmgpolicy.pid" if !$opt_pidfile;
 $opt_max_dequeue = 0 if $opt_testmode;
 
 initlog('pmgpolicy', 'mail');
@@ -889,7 +889,7 @@ sub run_n_children {
     setup_fork_signal_mask(0); # unblocking signals for parent
 }
 
-# test sig_hup with: for ((;;)) ;do kill -HUP  `cat /var/run/pmgpolicy.pid`; done;
+# test sig_hup with: for ((;;)) ;do kill -HUP  `cat /run/pmgpolicy.pid`; done;
 # wrapper to avoid multiple calls to sig_hup
 sub sig_hup {
     my $self = shift;
diff --git a/src/bin/pmgproxy b/src/bin/pmgproxy
index 57f3bd5..80790d9 100755
--- a/src/bin/pmgproxy
+++ b/src/bin/pmgproxy
@@ -20,7 +20,7 @@ $SIG{'__WARN__'} = sub {
 };
 
 my $prepare = sub {
-    my $rundir="/var/run/pmgproxy";
+    my $rundir="/run/pmgproxy";
     if (mkdir($rundir, 0700)) { # only works at first start if we are root)
 	my $gid = getgrnam('www-data') || die "getgrnam failed - $!\n";
 	my $uid = getpwnam('www-data') || die "getpwnam failed - $!\n";
-- 
2.20.1




More information about the pmg-devel mailing list