I am working on a package that needs two Upstart jobs: one that launches a daemon, and another that launches a supporting daemon if the configuration file requires it. The logic to determine if the supporting daemon should be launched involves processing the configuration file with
sed and friends, which causes problems with Upstart's daemonization detection (Upstart has no way to distinguish PIDs), so
expect fork and
expect daemon aren't useful. Unfortunately, this means Upstart detects the first invocation of
sed as the first PID, and immediately starts the main job, before the supporting daemon is fully initialized. This frequently leads to the premature termination of the main job, due to an improperly configured environment.
Is there any way to prevent Upstart from starting the main job too soon in this scenario?
expect stop looks like it's close to what I need, but I don't see a way to raise that signal without terminating one of the daemons, neither of which generate the SIGSTOP signal on their own.