I'm running Amazon Linux.

I originally installed Varnish 3 on this box, but have now installed Varnish 4.

sudo varnishd -a -f /etc/varnish/default.vcl 

...works just fine to start Varnish 4, and

pkill varnishd

...works fine to kill it.


service varnish stop

appears to control Varnish 3, and not Varnish 4. I'm very confused!

Why is this? What can I do to help this box forget about Varnish 3?

  • Have you checked to see if the service script even has a 'stop' command? – mdpc Jul 14 '14 at 20:16
  • service just passes the command to the /etc/init.d/varnish script. Perhaps that script was not updated upon upgrade. What method did you use to upgrade? – Bin Jul 14 '14 at 20:18
  • @mdpc It does! service varnish start will start a phantom version of Varnish 3 somewhere; service varnish stop will stop it. – jamescridland Jul 14 '14 at 20:19
  • @Bin - yum install; so perhaps I ought to go and take a look at that script? – jamescridland Jul 14 '14 at 20:19
  • @jamescridland Yes, also check there is no /etc/init.d/varnish4 script there or anything similar. – Bin Jul 14 '14 at 20:26

if you'd like to use service to stop Varnish, you should also use same service to start Varnish as well, and not running it manually like you do.

if you need to update your script, use either whereis or which to find where your binary is, then make sure that your init script points to same place as what you found:

# grep ^exec /etc/init.d/varnish

and that's all assuming you're using RHEL6, as for RHEL7 Varnish comes with systemd script:

$ rpm -q varnish
$ grep ^ExecStart /usr/lib/systemd/system/varnish.service 
ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF
ExecStart=/usr/sbin/varnishd \

also, unless there is an actual need, i don't think it's good idea to have both of them installed on same system.


You need to check the varnish init script and make sure it points to the correct server binary and pid file that are actually used by varnish 4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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