Skip to content

Instantly share code, notes, and snippets.

@joshenders
Last active December 13, 2016 01:22
Show Gist options
  • Save joshenders/5e432779437066a023aafaa7224751eb to your computer and use it in GitHub Desktop.
Save joshenders/5e432779437066a023aafaa7224751eb to your computer and use it in GitHub Desktop.
Patch for varnish-3.0.2-0ubuntu0.1 to enable safe stop
--- debian/varnish.init 2016-12-13 01:13:34.465123880 +0000
+++ debian/varnish.init.new 2016-12-13 01:18:50.215749771 +0000
@@ -88,8 +88,10 @@
log_daemon_msg "Reloading $DESC" "$NAME"
if /usr/share/varnish/reload-vcl -q; then
log_end_msg 0
+ return 0
else
log_end_msg 1
+ return 1
fi
}
@@ -112,7 +114,12 @@
esac
;;
stop)
- stop_varnishd
+ if reload_varnishd; then
+ stop_varnishd
+ else
+ log_daemon_msg "Refusing to stop $NAME due to invalid config on disk"
+ exit 1
+ fi
;;
reload)
reload_varnishd
@@ -121,7 +128,7 @@
status_varnishd
;;
restart|force-reload)
- $0 stop
+ $0 stop && \
$0 start
;;
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment