Comment 1 for bug 264711

Revision history for this message
Kelvin Chan (kelvin-t-chan) wrote : Re: expect fork/daemon do not work as expected

I got similar problem.

I found that the dbus-daemon did not got respawn when it was kill. After I killed dbus-daemon, the dbus-daemon pid gone (not shown in ps command), but upstart initctl reported that dbus-daemon is still running.

Here are the steps I performed:

1) I listed the dbus-daemon pid to make sure it's running, and it had pid 1031.
bash-3.00# ps axg | grep dbus-daemon
 1031 ? Ss 0:00 /usr/bin/dbus-daemon --fork --system
 1060 ? R+ 0:00 grep dbus-daemon

2) Then checked whether the job is running:
bash-3.00# /opt/upstart/sbin/initctl status systembus
systembus running

3) Killed the dbus-daemon process, and verified pid 1031 is gone:
bash-3.00# pidof dbus-daemon | xargs kill
bash-3.00# ps axg | grep dbus-daemon
 1066 ? R+ 0:00 grep dbus-daemon

4) After the kill above, upstart did not respawn dbus-daemon. Upstart think it's still alive:
bash-3.00# /opt/upstart/sbin/initctl status systembus
systembus running

5) Even when I had explicitly stop & start the job again, I did not see the dbus-daemon launched:
bash-3.00# /opt/upstart/sbin/initctl stop systembus
bash-3.00# /opt/upstart/sbin/initctl status systembus
systembus not running
bash-3.00# ps axg | grep dbus-daemon
bash-3.00# /opt/upstart/sbin/initctl start systembus
init: systembus main process (1076) killed by TRAP signal
init: systembus main process ended, respawning
bash-3.00# /opt/upstart/sbin/initctl status systembus
systembus running
bash-3.00# ps axg | grep dbus-daemon
 1079 ? R+ 0:00 grep dbus-daemon

Here is my 'systembus' job script that start the dbus-daemon:
bash-3.00# cat /etc/init/jobs.d/systembus
# DBUS system daemon
#
# started until it is shut down again.

start on stopped rc2 or stopped rc3 or stopped rc4 or stopped rc5

stop on runlevel 0 or runlevel 6

export PATH=/opt/upstart/sbin:$PATH

respawn
respawn limit 4 60

expect fork
exec /usr/bin/dbus-daemon --fork --system