Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my case, squid is started before DHCP has written a new /etc/resolv.conf which results in odd errors (timeouts, 504 Gateway) when I try to load a page in the web browser.

As I see it, the correct solution would be to start squid only after dhcpd/NetworkManager/whoever (?) has finished configuring the network.

share|improve this question
Which Ubuntu version are you using?. Or more concrete, are you using SysV or upstart?. – Javier Rivera Mar 26 '12 at 12:20
I'm on 11.10 and upstart. – Aaron Digulla Mar 26 '12 at 12:25
up vote 3 down vote accepted

You should modify the squid.conf file in /etc/init so that it only starts when network is up:

start on (started networking)

You can find much more info here, and looking at the files in your /etc/init/ dir.

This question should also help. If you prefer to configure it with a GUI, look here.

share|improve this answer

Here are two examples from the Upstart Cookbook:

To start a job when eth0 is available

start on net-device-up IFACE=eth0

To start once a non-loopback device has come up:

start on net-device-up IFACE!=lo

Note: net-device-up is not a regular job, it's an "Ubuntu well-known event".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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