Skip to contentSkip to conversation

package/quagga: Add systemd service

Buildroot Nathaniel Roach 2 participants 3 messages May 13, 2016 – May 17, 2016

lore
Share & tools
lore
#0 lore raw

Create a template unit, as there are a few different daemons available, but all of them accept/use the same basic runtime arguments.

Allow use of a /etc/default/ file to customise each daemon.

(Some daemons, like the zebra backend, have custom flags that cause other daemons to exit when used)

The zebra backend is required to modify routes on the host system, so we require it. Systemd handles this just fine, and a circular dependency is avoided

---
 package/quagga/quagga.service | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 package/quagga/quagga.service
package/quagga/quagga.service new file +19 -0
new file mode 100644
index 0000000..e7ab584
@@ -0,0 +1,19 @@
+[Unit]
+Description=Quagga %i routing daemon
+PartOf=quagga.service
+ReloadPropagatedFrom=quagga.service
+Requires=quagga at zebra.service
+
+[Service]
+PrivateTmp=true
+KillMode=mixed
+Type=forking
+EnvironmentFile=/etc/default/quagga-%i.conf
+ExecStart=/sbin/%i --daemon $OPTS -f /etc/quagga/%i.conf -i /var/run/quagga/%i.pid
+PIDFile=/var/run/quagga/%i.pid
+KillSignal=SIGINT
+Restart=on-failure
+RestartSec=1
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.8.1
#1 lore raw

There's two things wrong with this that I've spotted:

Firstly, do we want to run any binary under /sbin? Do we change the output folder of quagga's ./configure? Do we make a folder with symlinks?

Secondly, I'll change Requires=quagga at zebra.service to Wants= as we allow building quagga without zebra, and the other dameons can still talk on the network without it.

Thanks,

Nathaniel

Quoted 43 lines · Nathaniel Roach

Create a template unit, as there are a few different daemons available, but all of them accept/use the same basic runtime arguments.

Allow use of a /etc/default/ file to customise each daemon.

(Some daemons, like the zebra backend, have custom flags that cause other daemons to exit when used)

The zebra backend is required to modify routes on the host system, so we require it. Systemd handles this just fine, and a circular dependency is avoided

---
  package/quagga/quagga.service | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)

create mode 100644 package/quagga/quagga.service

package/quagga/quagga.service new file +19 -0
new file mode 100644
index 0000000..e7ab584
@@ -0,0 +1,19 @@
+[Unit]
+Description=Quagga %i routing daemon
+PartOf=quagga.service
+ReloadPropagatedFrom=quagga.service
+Requires=quagga at zebra.service
+
+[Service]
+PrivateTmp=true
+KillMode=mixed
+Type=forking
+EnvironmentFile=/etc/default/quagga-%i.conf
+ExecStart=/sbin/%i --daemon $OPTS -f /etc/quagga/%i.conf -i /var/run/quagga/%i.pid
+PIDFile=/var/run/quagga/%i.pid
+KillSignal=SIGINT
+Restart=on-failure
+RestartSec=1
+
+[Install]
+WantedBy=multi-user.target
#2 lore raw

Hello,

Quoted 2 lines · Nathaniel Roach

Firstly, do we want to run any binary under /sbin? Do we change the output folder of quagga's ./configure? Do we make a folder with symlinks?

Why wouldn't we want to run a binary from /sbin? What's the problem with that?

Moreover, keep in mind that when systemd is used, /usr/sbin and /sbin are the same thing.

Quoted 3 lines

Secondly, I'll change Requires=quagga at zebra.service to Wants= as we allow building quagga without zebra, and the other dameons can still talk on the network without it.

This is too systemd specific for my knowledge, so I'll trust what you submit.

Since you said yourself that you will send an updated version with additional fixes, I've marked this one as Changes Requested in patchwork.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com