upstart process states

Asked by bwm71 on 2009-06-26

I've configured a daemon to be started and controlled using Upstart. I used /etc/event.d/tty1 as my template for creating the job file which looks like

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

  stop on runlevel 0
  stop on runlevel 1
  stop on runlevel 6

  exec /opt/barcode/bin/pm8300rdr --ip 192.168.1.15 --port 14000

  normal exit 0 TERM

  respawn

However, from the output of "initctl list", the state of this job is

  # initctl list pm8300rdr
  pm8300rdr (stop) waiting

while the state of tty1 is

  # initctl list tty1
  tty1 (start) running, process 6508

My job, pm8300rdr, does fork() on startup and the parent exits. My question is how do I communicate the PID back to Upstart and have the job show as "running" instead of "waiting". Is this because I'm fork()'ing and the parents exits? Should I even be concerned about this? The daemon is working fine as is.

I'm using Upstart 0.3.9 on Ubuntu.

Question information

Language:
English Edit question
Status:
Solved
For:
upstart Edit question
Assignee:
No assignee Edit question
Solved by:
bwm71
Solved:
2009-06-29
Last query:
2009-06-29
Last reply:
2009-06-29

On Fri, 2009-06-26 at 14:03 +0000, bwm71 wrote:

> My job, pm8300rdr, does fork() on startup and the parent exits. My
> question is how do I communicate the PID back to Upstart and have the
> job show as "running" instead of "waiting". Is this because I'm
> fork()'ing and the parents exits? Should I even be concerned about
> this? The daemon is working fine as is.
>
Correct, Upstart is unable to supervises processes that fork() on
startup. Check whether pm8300rdr has an option to remain in the
foreground.

Scott
--
Scott James Remnant
<email address hidden>

bwm71 (brandon-geronimoalloys) said : #2

Thanks. I'm the author of pm8300rdr, so I can modify it to not fork().