The init script that is installed with varnish is able to start the daemon, but not stop it. Reproducible: Always Steps to Reproduce: 1. sudo /etc/init.d/varnishd start 2. sudo /etc/init.d/varnishd stop 3. ps -fC varnishd Actual Results: Some varnishd processes are listed Expected Results: No varnishd processes should be listed The pidfile referred to in the start-stop-daemon lines in the script isn't created by varnishd. I've got it to work by removing the --pidfile flags and using "--stop --name varnishd" to stop the daemon, but I'm not sure if that's the best solution.
Created attachment 119588 [details, diff] Patch for files/varnishd.initd This is what I've changed in a local overlay to get this to work as expected.
Created attachment 119671 [details, diff] another patch Since the pid-file should always be created, I think a better way to do this is to pass the --make-pidfile with the initscript. The example patch included as an attachment also hides the unneccessary messages during startup. Can you test whether it works for you?
i appreciate your feedback! the pidfile stuff doesn't work as expected here... this is the patch i applied: @@ -9,12 +9,12 @@ start() { ebegin "Starting varnish" - start-stop-daemon --quiet --start --pidfile /var/run/varnishd.pid --exec /usr/sbin/varnishd -- ${VARNISHD_OPTS} + start-stop-daemon --quiet --start --exec /usr/sbin/varnishd -- ${VARNISHD_OPTS} &> /dev/null eend $? } stop() { ebegin "Stopping varnish" - start-stop-daemon --quiet --stop --pidfile /var/run/varnishd.pid + start-stop-daemon --quiet --stop --name varnishd eend $? } does that work for you?
(In reply to comment #2) > Created an attachment (id=119671) [edit] > another patch > > Since the pid-file should always be created, I think a better way to do this is > to pass the --make-pidfile with the initscript. The example patch included as > an attachment also hides the unneccessary messages during startup. Can you test > whether it works for you? > I just tried that here, but the process in the generated pidfile didn't exist. $ sudo /etc/init.d/varnishd start $ ls -l /var/run/varnishd.pid -rw-r--r-- 1 root root 6 2007-05-21 12:29 /var/run/varnishd.pid $ ps -fp `<!$` ps -fp `</var/run/varnishd.pid` UID PID PPID C STIME TTY TIME CMD $ cat /var/run/varnishd.pid 26453 $ ps -fC varnishd UID PID PPID C STIME TTY TIME CMD root 26484 1 0 12:29 ? 00:00:00 /usr/sbin/varnishd ... root 26485 26484 0 12:29 ? 00:00:00 /usr/sbin/varnishd ... Matt
FYI: varnish 1.0.4 (released 20 May 2007) has support for pidfiles. (-P option to varnishd) It also now supports daemonising varnishlog (also with pidfile support).
Thanks for the input. The new init script in cvs creates and uses the pidfile - I did not bump the latest release, please simply remerge.