<div dir="ltr">Carsten,<div><br></div><div><div>The script in my original question (it's in the P.S. at the bottom of my first mail) seem to work for me. It does not cover all the extra logic of the ubuntu default init.d/bind9, but I personally don't need that (ubuntu script may update resolv.conf, and also checks if there's a network available).</div>

</div><div><br></div><div>But now I realised that it's all much simpler. "named -f" runs bind in the foreground (does not daemonise) and that's just what upstart needs. Here's my new upstart job file, p<span style="font-family:arial,sans-serif;font-size:13px">lace it to /etc/init/bind.conf (I can't decide which one is better: bind.conf, bind9.conf or named.conf :)</span></div>
<div><div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">#UPSTART JOB FOR BIND9</div><div style="font-family:arial,sans-serif;font-size:13px"></div></div><div><div>start on runlevel [2345]</div><div>stop on runlevel [!2345]</div>

<div><br></div><div>pre-start script</div><div><span style="white-space:pre-wrap">  </span># dirs under /var/run can go away on reboots.</div><div><span style="white-space:pre-wrap">    </span>mkdir -p /var/run/named</div>
<div><span style="white-space:pre-wrap">  </span>chmod 775 /var/run/named</div><div><span style="white-space:pre-wrap"> </span>chown root:bind /var/run/named >/dev/null 2>&1 || true</div><div>end script</div>
<div><br></div><div>#Add bind command-line options below</div><div>exec /usr/sbin/named -f -u bind</div><div><br></div><div>pre-stop exec rndc stop</div><div><br></div><div style="font-family:arial,sans-serif;font-size:13px">
post-stop exec logger -p user.warning -t upstart-bind "bind stopped"<br>
</div><div><br></div><div>respawn</div><div>respawn limit 3 10</div><div>kill timeout 30</div><div>console none</div></div></div><div>#END</div><div><br></div><div>It will run bind on runlevels 2345, stop bind on other runlevels, but the most important - respawn it once it stops with one it's famous assertion failures :). It also logs a warning to syslog when bind closes (I use something like that to send me an email).<br>
</div><div><div><div><br></div><div>If someone wants to use the job, here's some instructions: 1. don't forget to disable the init.d script, or you may end up with two conflicting nameds - the easiest way is <span style="background-color:rgb(243,243,243);color:rgb(51,51,51);font-family:UbuntuMono,courier,monospace;font-size:13px;line-height:16px;text-align:left;white-space:pre-wrap">sudo chmod -x /etc/init.d/bind9</span> . 2. As with any upstart job, to stop bind you now do "stop bind", to start - "start bind", and there's also "restart bind". If you have your fancy stuff in /etc/defaults/bind9, just add at to the end of the "exec" line. </div>
</div><div><br></div><div><div>It seems to work for me, but I can't say it's really tested. Comments and improvements are greatly appreciated.</div><div><br></div><div></div></div><div><div></div></div></div><div>
Alex,<br></div><div><a href="http://net-me.net" target="_blank">net-me.net</a></div><div><div style="font-family:arial,sans-serif;font-size:13px"><br></div></div></div>