<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">respawn does not seem to work for&nbsp;daemonized&nbsp; or forked process.<div><br></div><div>I have a 'systembus' job to launch &amp; respawn the dbus-daemon, it look like this:</div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'"># DBUS system daemon &nbsp;</font></div><div><font class="Apple-style-span" face="'Courier New'">#</font></div><div><font class="Apple-style-span" face="'Courier New'"># started until it is shut down again.</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">start on stopped rc2 or stopped rc3 or stopped rc4 or stopped rc5</font></div><div><font class="Apple-style-span" face="'Courier New'">stop on runlevel 0 or runlevel 6</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">export PATH=/opt/upstart/sbin:$PATH</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">respawn&nbsp;</font></div><div><font class="Apple-style-span" face="'Courier New'">respawn limit 4 60</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">expect fork&nbsp;</font></div><div><font class="Apple-style-span" face="'Courier New'">exec /usr/bin/dbus-daemon --fork --system</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div>I found that the dbus-daemon did not get respawn when it was killed.</div><div>After I killed dbus-daemon, the dbus-daemon process was gone (not shown on ps command).</div><div>But upstart initctl reported dbus-daemon still in running state.</div><div><br></div><div>Here are the steps I performed:</div><div><br></div><div>1) I listed the dbus-daemon process to make sure it was started. It had pid 1031:</div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# ps axg | grep dbus-daemon</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;1031 ? &nbsp; &nbsp; &nbsp; &nbsp;Ss &nbsp; &nbsp; 0:00 /usr/bin/dbus-daemon --fork --system</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;1062 ? &nbsp; &nbsp; &nbsp; &nbsp;R+ &nbsp; &nbsp; 0:00 grep dbus-daemon</font></div><div><br></div><div>2) I checked the job status and upstart reported it's running:</div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl status systembus</font></div><div><font class="Apple-style-span" face="'Courier New'">systembus running</font></div><div><br></div><div>3) I killed the dbus-daemon process, and verified pid 1031 was actually got kill:</div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# pidof dbus-daemon | xargs kill</font></div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# ps axg | grep dbus-daemon</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;1068 ? &nbsp; &nbsp; &nbsp; &nbsp;R+ &nbsp; &nbsp; 0:00 grep dbus-daemon</font></div><div><br></div></div><div>4) I noticed upstart did not respawn the dbus-daemon after it was killed.</div><div>Upstart reported the dbus-daemon (or systembus job) is still running:</div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl status systembus</font></div><div><font class="Apple-style-span" face="'Courier New'">systembus running</font></div><div><br></div></div><div>5) After I had&nbsp;explicitly&nbsp;stopped &amp; started the job again,&nbsp;</div><div>I did not see upstart respawn the dbus-daemon.</div><div>Although upstart reported that dbus-daemon is running:</div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl stop systembus</font></div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl status systembus</font></div><div><font class="Apple-style-span" face="'Courier New'">systembus not running</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# ps axg | grep dbus-daemon</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl start systembus</font></div><div><font class="Apple-style-span" face="'Courier New'">init: systembus main process (1079) killed by TRAP signal</font></div><div><font class="Apple-style-span" face="'Courier New'">init: systembus main process ended, respawning</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# /opt/upstart/sbin/initctl status systembus</font></div><div><font class="Apple-style-span" face="'Courier New'">systembus running</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">bash-3.00# ps axg | grep dbus-daemon</font></div><div><br></div><div>/Kelvin Chan</div></div></div></div></div></div></body></html>