В Fri, 19 Apr 2013 22:01:41 -0700 Peter Li <chinasau...@gmail.com> пишет:
> On 04/19/2013 04:16 AM, Colin Guthrie wrote: > <snip> > >> When I then run `systemctl start wsgw; systemctl status wsgw` I get: > >> > >> wsgw.service - WebSockets Gateway for pianod > >> Loaded: loaded (/usr/lib/systemd/system/wsgw.service; enabled) > >> Active: active (running) since Thu, 18 Apr 2013 22:09:40 > >> -0700; 7ms ago > >> Main PID: 2565 (wsgw) > >> CGroup: name=systemd:/system/wsgw.service > >> └ 2565 /usr/sbin/wsgw -p 8000 pianod,localhost,4445,text > > I suspect that on boot the network or name resolution is not available > > and your service is started "too soon". > <snip> > > Thanks for your reply. I'm now pretty sure the issue is that the > service calls getaddrinfo(...) when it starts, and that returns > EAI_NONAME if this is run too early in boot. But I've now tried adding > After=network.target and that doesn't seem to help; is there something > else I need to wait for so that getaddrinfo() will succeed? > It is up to your distribution how (and whether) it implements detection of "network up" condition and delays network.target until it is detected. E.g. openSUSE with NetworkManager defaults to no wait (NM_ONLINE_TIMEOUT="0"). Check documentation for your distribution how it can be enabled. Alternatively you may consider if it possible to provide required information statically (e.g. - in /etc/hosts) or to use something like sssd to cache answer. One more possibility is to start your application on network up and not on boot. Again, NetworkManager provides needed hooks and older configuration using ifup had something like this too. _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel