[arch-projects] [netcfg][PATCH 2/2] systemd: wait for network to come up
From: Tom Gundersen <teg@jklm.no> We need to make sure no the systemd services are only considered started when the network is actually up. Otherwise, things relying on the network don't know when they can start. This means that we need to use Type=forking or Type=oneshot, and in the case of ifplugd we must daemonize and wait for the daemon to be ready before we continue. Also do some minor cleanup: - don't include env files that are not used - don't ignore return values Signed-off-by: Tom Gundersen <teg@jklm.no> --- WARNING: THIS IS COMPLETELY UNTESTED. Consider this a glorified bug report :-) systemd/net-auto-wired.service | 7 +++---- systemd/netcfg.service | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/systemd/net-auto-wired.service b/systemd/net-auto-wired.service index 3c5cf62..467b62e 100644 --- a/systemd/net-auto-wired.service +++ b/systemd/net-auto-wired.service @@ -4,11 +4,10 @@ Before=network.target Wants=network.target [Service] +Type=forking EnvironmentFile=/etc/conf.d/netcfg -EnvironmentFile=-/etc/ifplugd/ifplugd.conf -ExecStart=-/usr/sbin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -fIn -u0 -d10 -ExecStop=-/usr/sbin/ifplugd -k -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -Type=simple +ExecStart=/usr/sbin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -fIw -d10 +ExecStop=/usr/sbin/ifplugd -i $WIRED_INTERFACE -r /etc/ifplugd/netcfg.action -k [Install] WantedBy=multi-user.target diff --git a/systemd/netcfg.service b/systemd/netcfg.service index a4e5ddc..e9dcfbc 100644 --- a/systemd/netcfg.service +++ b/systemd/netcfg.service @@ -6,7 +6,6 @@ Wants=network.target [Service] Type=oneshot RemainAfterExit=yes -EnvironmentFile=/etc/conf.d/netcfg ExecStart=/usr/bin/netcfg-daemon start ExecStop=/usr/bin/netcfg-daemon stop -- 1.7.10
On Tue, Apr 17, 2012 at 18:36, <teg@jklm.no> wrote:
From: Tom Gundersen <teg@jklm.no> Also do some minor cleanup: - don't include env files that are not used
Signed-off-by: Tom Gundersen <teg@jklm.no> ---
diff --git a/systemd/netcfg.service b/systemd/netcfg.service index a4e5ddc..e9dcfbc 100644 --- a/systemd/netcfg.service +++ b/systemd/netcfg.service @@ -6,7 +6,6 @@ Wants=network.target [Service] Type=oneshot RemainAfterExit=yes -EnvironmentFile=/etc/conf.d/netcfg ExecStart=/usr/bin/netcfg-daemon start ExecStop=/usr/bin/netcfg-daemon stop
This service should not be started when the env file is missing, so including it makes sense, doesn't it? The rest of the patch looks fine.
On Tue, Apr 17, 2012 at 11:06 PM, Jouke Witteveen <j.witteveen@gmail.com> wrote:
-EnvironmentFile=/etc/conf.d/netcfg ExecStart=/usr/bin/netcfg-daemon start ExecStop=/usr/bin/netcfg-daemon stop
This service should not be started when the env file is missing, so including it makes sense, doesn't it?
The meaning of EnvironmentFile is that it will be imported into the service file and you can then use the varibles in it. But since you don't use any variables in this service file it does not make much sense. If what you want is to avoid a service being started if a file does not exist, then ConditionPathExists= is the correct thing to use. However, I don't really see the point of that here. netcfg-daemon should check for the configfile and if it is missing or illegal then the daemon should exit with an error code, imo. -t
On Tue, Apr 17, 2012 at 23:48, Tom Gundersen <teg@jklm.no> wrote:
On Tue, Apr 17, 2012 at 11:06 PM, Jouke Witteveen <j.witteveen@gmail.com> wrote:
-EnvironmentFile=/etc/conf.d/netcfg ExecStart=/usr/bin/netcfg-daemon start ExecStop=/usr/bin/netcfg-daemon stop
This service should not be started when the env file is missing, so including it makes sense, doesn't it?
If what you want is to avoid a service being started if a file does not exist, then ConditionPathExists= is the correct thing to use.
Ah right.
However, I don't really see the point of that here. netcfg-daemon should check for the configfile and if it is missing or illegal then the daemon should exit with an error code, imo.
Agreed. It does so already.
participants (3)
-
Jouke Witteveen
-
teg@jklm.no
-
Tom Gundersen