Server Fault is a question and answer site for system and network administrators. 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

I'd like to run a script when Varnish starts.
This script should execute a webrequest to a webserver (its backend), which then makes sure Varnish's cache gets filled with all pages residing on this webserver. So this script makes sure everyting is in Varnish's cache when Varnish (re)starts, because we're using Varnish as cache and fail-over (the webserver should be able to be down for let's say a week for example, without any consequences).

What are the possibilities to do this?

We can't just edit /etc/init.d/varnish and /usr/sbin/varnishd because they can het overwritten when updating varnish?


share|improve this question

Realistically, your best bet is to edit /etc/init.d/varnish, and flag that you'll need to re-apply your changes every upgrade.

You can set the init.d script unwriteable (via chmod 550), or if you're using extfs, make it unchangeable with chattr +i.

There isn't currently a way to hook arbitrary scripts into the varnish startup as far as I'm aware, but you could always make a feature-request for that on the Varnish bugtracker:

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.