1

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!

kipusoep
  • 111
  • 3

1 Answers1

0

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/

Kirrus
  • 482
  • 2
  • 11