systemd: reference pidfiles in service files

quagga daemons don't remove pidfiles before exit. Previously it was done by
init script, now pidfiles stay around after daemon is stopped. If they are
referenced in service files systemd will remove them automatically after service
is stopped.

Also fix typo, there is no BindTo dependency, change to BindsTo.
This commit is contained in:
Michal Sekletar 2014-01-06 13:14:51 +01:00
parent 278464f2ec
commit 935ba739d0
2 changed files with 67 additions and 62 deletions

View File

@ -1,168 +1,169 @@
From 318afd68d26818eff24b3dfe94fa01b8dad873eb Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 11 Jun 2013 19:17:09 +0200
Subject: [PATCH] systemd: change the WantedBy target
Previously with configuration WantedBy=network.target it could happen
that after enabling let's say zebra and bgpd and restarting the server
services won't be started. In case when no service pulls in
network.target quagga daemons won't start, because they are enabled
under network.target. This might be the case when only zebra is used
for configuring interfaces and other services like NM and initscripts
are disabled.
This commit also removes ordering dependency on syslog.target, since
this is redundant these days, because systemd-journald is early boot
service.
---
redhat/babeld.service | 4 ++--
redhat/bgpd.service | 4 ++--
redhat/isisd.service | 4 ++--
redhat/ospf6d.service | 4 ++--
redhat/ospfd.service | 4 ++--
redhat/ripd.service | 4 ++--
redhat/ripngd.service | 4 ++--
redhat/zebra.service | 5 +++--
8 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/redhat/babeld.service b/redhat/babeld.service
index b1ea943..2182de7 100644
index b1ea943..a7ea7fe 100644
--- a/redhat/babeld.service
+++ b/redhat/babeld.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=Babel routing daemon
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/babeld.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/babeld -d $BABELD_OPTS -f /etc/quagga/babeld.conf
Type=forking
+PIDFile=/run/quagga/babeld.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/babeld -d $BABELD_OPTS -f /etc/quagga/babeld.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/bgpd.service b/redhat/bgpd.service
index 5040284..b48a053 100644
index 5040284..af923df 100644
--- a/redhat/bgpd.service
+++ b/redhat/bgpd.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=BGP routing daemon
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/bgpd.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/bgpd -d $BGPD_OPTS -f /etc/quagga/bgpd.conf
Type=forking
+PIDFile=/run/quagga/bgpd.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/bgpd -d $BGPD_OPTS -f /etc/quagga/bgpd.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/isisd.service b/redhat/isisd.service
index 4cdf67d..d5c2438 100644
index 4cdf67d..8687601 100644
--- a/redhat/isisd.service
+++ b/redhat/isisd.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=IS-IS routing daemon
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/isisd.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/isisd -d $ISISD_OPTS -f /etc/quagga/isisd.conf
Type=forking
+PIDFile=/run/quagga/isisd.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/isisd -d $ISISD_OPTS -f /etc/quagga/isisd.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/ospf6d.service b/redhat/ospf6d.service
index 3c9c466..f9759f5 100644
index 3c9c466..d13e970 100644
--- a/redhat/ospf6d.service
+++ b/redhat/ospf6d.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=OSPF routing daemon for IPv6
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/ospf6d.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/ospf6d -d $OSPF6D_OPTS -f /etc/quagga/ospf6d.conf
Type=forking
+PIDFile=/run/quagga/ospf6d.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/ospf6d -d $OSPF6D_OPTS -f /etc/quagga/ospf6d.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/ospfd.service b/redhat/ospfd.service
index 5e3de23..c2887e7 100644
index 5e3de23..959e649 100644
--- a/redhat/ospfd.service
+++ b/redhat/ospfd.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=OSPF routing daemon
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/ospfd.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/ospfd -d $OSPFD_OPTS -f /etc/quagga/ospfd.conf
Type=forking
+PIDFile=/run/quagga/ospfd.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/ospfd -d $OSPFD_OPTS -f /etc/quagga/ospfd.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/ripd.service b/redhat/ripd.service
index d35dc47..cc4142a 100644
index d35dc47..8e7290e 100644
--- a/redhat/ripd.service
+++ b/redhat/ripd.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=RIP routing daemon
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/ripd.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/ripd -d $RIPD_OPTS -f /etc/quagga/ripd.conf
Type=forking
+PIDFile=/run/quagga/ripd.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/ripd -d $RIPD_OPTS -f /etc/quagga/ripd.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/ripngd.service b/redhat/ripngd.service
index 567e888..35365e7 100644
index 567e888..1ba6dcf 100644
--- a/redhat/ripngd.service
+++ b/redhat/ripngd.service
@@ -1,7 +1,7 @@
@@ -1,14 +1,15 @@
[Unit]
Description=RIP routing daemon for IPv6
BindTo=zebra.service
-BindTo=zebra.service
-After=syslog.target network.target zebra.service
+BindsTo=zebra.service
+After=zebra.service
ConditionPathExists=/etc/quagga/ripngd.conf
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/sbin/ripngd -d $RIPNGD_OPTS -f /etc/quagga/ripngd.conf
Type=forking
+PIDFile=/run/quagga/ripngd.pid
EnvironmentFile=/etc/sysconfig/quagga
ExecStart=/usr/sbin/ripngd -d $RIPNGD_OPTS -f /etc/quagga/ripngd.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
diff --git a/redhat/zebra.service b/redhat/zebra.service
index 27c3a52..5b9e454 100644
index 27c3a52..259fc20 100644
--- a/redhat/zebra.service
+++ b/redhat/zebra.service
@@ -1,6 +1,7 @@
@@ -1,14 +1,16 @@
[Unit]
Description=GNU Zebra routing manager
-After=syslog.target network.target
@ -171,12 +172,13 @@ index 27c3a52..5b9e454 100644
ConditionPathExists=/etc/quagga/zebra.conf
[Service]
@@ -11,4 +12,4 @@ ExecStart=/usr/sbin/zebra -d $ZEBRA_OPTS -f /etc/quagga/zebra.conf
Type=forking
+PIDFile=/run/quagga/zebra.pid
EnvironmentFile=-/etc/sysconfig/quagga
ExecStartPre=/sbin/ip route flush proto zebra
ExecStart=/usr/sbin/zebra -d $ZEBRA_OPTS -f /etc/quagga/zebra.conf
Restart=on-abort
[Install]
-WantedBy=network.target
+WantedBy=multi-user.target
--
1.8.1.4

View File

@ -7,7 +7,7 @@
Name: quagga
Version: 0.99.22.4
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Routing daemon
License: GPLv2+
Group: System Environment/Daemons
@ -225,6 +225,9 @@ fi
%{_includedir}/quagga/ospfd/*.h
%changelog
* Mon Jan 14 2013 Michal Sekletar <msekleta@redhat.com> - 0.99.22.4-2
- reference pidfiles in service files (#1025798)
* Fri Sep 13 2013 Michal Sekletar <msekleta@redhat.com> - 0.99.22.4-1
- update to 0.99.22.4