[arch-general] systemd start a daemon after the Internet connection is established

Bill Sun cap.sensitive at gmail.com
Mon Sep 16 03:50:21 EDT 2013


On Sun, Sep 08, 2013 at 07:27:34PM +0200, Lukas Jirkovsky wrote:
> On 8 September 2013 18:37, Bill Sun <cap.sensitive at gmail.com> wrote:
> > When the server is connected to the Internet, this service file can
> > launch the proxy successfully, but it doesn't work on system startup,
> > supposedly due to the lack of an connection with Internet access. So I
> > need systemd to make sure the connect has been established before it
> > launch this daemon.
> >
> > Regards.
>
> Try network-online.target instead of network.target.
No. It still doesn't work. I don't use NetworkManger, so my assumption
is that the network-online.target does not exist at all. (Seems that
`systemctl list-units` confirms that.)

I use dhcpcd@%i to get an ip address from my router. Though the dhcpcd
does start before my proxy daemon, the proxy daemon fails before the
dhcpcd get an address.

So how to write another systemd unit to make sure the Internet connect
is established? (maybe a bash script with ping, then checking the exit
code? But how to write that systemd unit?)

Regards.


More information about the arch-general mailing list