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 a server I have memcached and apache2 installed, I want my apache2 ONLY can start if memcached is started, so in my apache upstart script, I added the line


start on runlevel [2345]


start on runlevel [2345] and memcached

I found my apache2 cannot be started then, any hints to debug?

share|improve this question

and memcached means "and an event named memcached is emitted". I think you meant

start on runlevel [2345] and started memcached

However, this will also fail you because the 'runlevel 2' event will only be emitted once, at boot time (or whenever you return from single user mode). What you probably actually mean is just

start on started memcached

The runlevel [2345] is implied by the fact that memcached will only be started on runlevel [2345]. However, this is also a fairly limited approach. What if you move memcached off these boxes so they can run on a dedicated memcached cluster? Now you can't control boot order. The better approach is for your application to be fault tolerant and handle the lack of memcached gracefully.

Whether this means alerting your load balancer to not send traffic to this node, or just sending back a "please wait" ajax spinner to your users, this will lead to less pages for your ops guys, and more resilience for your application in general.

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.