I have a service (small http service that listens on 0.0.0.0:8080) written in python that starts at system boot. The problem is that sometimes at server boot it starts too soon, when even IPv4 is not yet initialized (?) by kernel. Serivce failes with error (from /var/log/upstart):
socket.gaierror: [Errno -9] Address family for hostname not supported
When starting manually later it starts normally. Adding 'sleep 30' in pre-start section also helps. But I would like to know if there is a better and cleaner way to specify in upstart configuration that this service needs working ipv4. It does not need full "routing" or default gateway or even configured loopback. All it needs is the ability to bind to "any" (0.0.0.0) IPv4 address.