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?
Asked
Active
Viewed 4,565 times
1 Answers
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
".
![](../../users/profiles/252343.webp)
wurzel
- 3
- 3
![](../../users/profiles/107529.webp)
jamesodhunt
- 849
- 5
- 4
-
5As 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
-
2The 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