On Mon, Sep 16, 2013 at 9:50 AM, Bill Sun <cap.sensitive@xxxxxxxxx> wrote: > On Sun, Sep 08, 2013 at 07:27:34PM +0200, Lukas Jirkovsky wrote: > > On 8 September 2013 18:37, Bill Sun <cap.sensitive@xxxxxxxxx> 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. > > That is weird... dhcpcd@.service has the following lines: Type=forking ExecStart=/usr/sbin/dhcpcd -q -w %I The -w option to the daemon (--waitip) is there so that it will not fork to the background until an IP is available. And the systemd unit is of type *forking*, so it will not be *started* until it has forked. So, if your proxy has an "After=" relation to dhcpcd@eth0.service, then it should not be started without an IP address. Are you sure it so? You can check whether that's the case: $ systemctl show myproxy.service | grep After= -- Rodrigo