Yes, $PID_FILE and "normal exit 0" was important, without "normal exit" the process would be respawned as soon as it was stopped in pre-stop.  
<br/><br/>description &quot;RabbitMQ Server&quot;
<br/>start on runlevel [2345]
<br/>stop on runlevel [016]
<br/>kill timeout 60
<br/>respawn
<br/>respawn limit 10 5
<br/>normal exit 0 
<br/>console log
<br/>setuid rabbitmq
<br/>setgid rabbitmq
<br/>env HOME=/var/lib/rabbitmq
<br/>env PID_FILE=/var/run/rabbitmq/pid
<br/>exec /usr/lib/rabbitmq/bin/rabbitmq-server
<br/>post-start exec /usr/sbin/rabbitmqctl wait $PID_FILE
<br/>pre-stop exec /usr/sbin/rabbitmqctl stop $PID_FILE
<br/><br/><br/>Thanks! &nbsp;
<br/><br/><br/>On Tuesday 26 March 2013 at 21:15, Simon MacMullen-2 [via RabbitMQ] wrote:
<br/><div class='shrinkable-quote'><br/>&gt; On 26/03/13 13:09, Tim Watson wrote: 
<br/>&gt; &gt; On 26 Mar 2013, at 12:25, Simon MacMullen wrote: 
<br/>&gt; &gt; &gt; Note that you are also running as root. So I would modify two lines: 
<br/>&gt; &gt; &gt; 
<br/>&gt; &gt; &gt; post-start exec /usr/sbin/rabbitmqctl wait /var/run/rabbitmq/pid 
<br/>&gt; &gt; &gt; pre-stop exec /usr/sbin/rabbitmqctl stop /var/run/rabbitmq/pid 
<br/>&gt; &gt; 
<br/>&gt; &gt; 
<br/>&gt; &gt; Doesn't the previous setuid/setgid deal with that? 
<br/>&gt; 
<br/>&gt; Argh; I wrote the &quot;Note that&quot; before noticing the setuid/setgid, then 
<br/>&gt; failed to delete it. Please ignore. 
<br/>&gt; 
<br/>&gt; Cheers, Simon 
<br/>&gt; 
<br/>&gt; -- 
<br/>&gt; Simon MacMullen 
<br/>&gt; RabbitMQ, VMware 
<br/>&gt; _______________________________________________ 
<br/>&gt; rabbitmq-discuss mailing list 
<br/>&gt; [hidden email] (/user/SendEmail.jtp?type=node&amp;node=25728&amp;i=0) 
<br/>&gt; <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_top" rel="nofollow" link="external">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br/>&gt; 
<br/>&gt; 
<br/>&gt; If you reply to this email, your message will be added to the discussion below: <a href="http://rabbitmq.1065348.n5.nabble.com/SIGTERM-tp25695p25728.html" target="_top" rel="nofollow" link="external">http://rabbitmq.1065348.n5.nabble.com/SIGTERM-tp25695p25728.html</a>&nbsp;
<br/>&gt; To unsubscribe from SIGTERM, click here (<a href="" target="_top" rel="nofollow" link="external">
<br/>&gt; NAML (<a href="http://rabbitmq.1065348.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" target="_top" rel="nofollow" link="external">http://rabbitmq.1065348.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>) 
</div><br/><br/><br/>

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/SIGTERM-tp25695p25732.html">Re: SIGTERM</a><br/>
Sent from the <a href="http://rabbitmq.1065348.n5.nabble.com/">RabbitMQ mailing list archive</a> at Nabble.com.<br/>