I have a service (small http service that listens on 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" ( IPv4 address.


You can configure your job to start when the start on (started networking) event is triggered.

started This event is emitted by Upstart when a job is now running. Note that a job does not have to have an associated program or script so "running" does not necessarily imply that any additional process is executing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.