From 809a45394fd1abc72e02ca6104e83cd75f017601 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 28 Jun 2016 21:06:43 -0700 Subject: [PATCH] puppet: Start supervisord if it isn't running on restart. --- puppet/zulip/manifests/supervisor.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/puppet/zulip/manifests/supervisor.pp b/puppet/zulip/manifests/supervisor.pp index 00a1756851..079b2581d2 100644 --- a/puppet/zulip/manifests/supervisor.pp +++ b/puppet/zulip/manifests/supervisor.pp @@ -21,8 +21,11 @@ class zulip::supervisor { # the changed configuration until you do an "update" (I assume # this is so you can check if your config file parses without # doing anything, but it's really confusing) + # + # Also, to handle the case that supervisord wasn't running at all, + # we check if it is not running and if so, start it. hasrestart => true, - restart => "bash -c 'supervisorctl reread && supervisorctl update'" + restart => "bash -c 'if pgrep -f supervisord >/dev/null; then supervisorctl reread && supervisorctl update; else /etc/init.d/supervisor start; fi'" } file { "/etc/supervisor/supervisord.conf":