6

I'd like to be able to use upstart to manage daemons where I don't have complete control over the forking behaviour. The "pid" stanza is removed as of version 0.3.9, so I can't point it at a pid file. What is the correct way to go about this? Do I have to write a wrapper script that issues SIGSTOP?

mispy
  • 171
  • 1
  • 3

1 Answers1

2

Read this section of the Upstart Cookbook very carefully: http://upstart.ubuntu.com/cookbook/#expect

In a nutshell, if your daemon forks once, use "expect fork". If it truly daemonizes (double-forks), specify "expect daemon".

wurzel
  • 3
  • 3
jamesodhunt
  • 849
  • 5
  • 4
  • 5
    As mentioned, I don't have complete control over the forking behaviour. I can't know how many times the application will fork before getting to the true process. I *do* have a pid file, however, and it seems strange that there is no way to communicate this information to upstart. – mispy May 02 '12 at 00:15
  • 1
    @mispy: well, that's design of upstart: to be able to reliably monitor a daemon, it needs to know its forking behaviour and pid files do not help (as pids they contain *can* differ from reality). – thor May 11 '13 at 20:11
  • 2
    The fun part is when you are experimenting to figure out how many forks to expect, upstart can wedge completely in such a way that it blocks reboot and necessitates a power cycling of the system. Being able to check a pid file, which has worked forever, would be a reasonable feature. – dannyman May 13 '15 at 23:34