Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

Thanks!

share|improve this question

1 Answer 1

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:
https://www.varnish-cache.org/trac/

share|improve this answer

Your Answer

 
discard

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.