I have a 16.04 Desktop box that connects to the internet via WiFi. For ease of remote management, wlan0
is configured via /etc/network/interfaces
instead of network manager.
I have a systemd
service that is enabled to start on boot. This service is set to start after default.target
like so:
[Unit]
After=default.target
[Service]
Type=simple
ExecStart=/usr/bin/node main.js"
Restart=always
[Install]
WantedBy=default.target
This service starts immediately if I boot up the box in range of its wifi network, because dhclient immediately receives an IP. But if I boot up my system where it can't get on the wifi, my service sits around and waits for dhclient to give up before kicking off. This service waits precisely the 300 seconds specified in the /etc/dhclient/dhclient.conf
timeout 300
stanza.
My understanding of After=default.target
was that it would NOT wait on network. After=network.target
is the tool to do that. If I configure my wifi with Network Manager instead of /etc/network/interfaces
, the service gets started immediately regardless of network availability.
How can I get my service to start regardless of the status of dhclient
while still using /etc/network/interfaces
?