I came up with a hack to use upstart with applications that fork more
than twice to use until the rewrite makes it downstream. It works for my
application on my system. YMMV.

1.    start the application in the pre-start section
2.    in the script section run a script that runs as long as the application 
runs. The pid of this script is what upstart will track.
3.    in the post-stop section kill the application

example

env DAEMON=/usr/bin/forky-application

pre-start script
    su -s /bin/sh -c "$DAEMON" joeuseraccount
end script

script 
    sleepWhileAppIsUp(){
        while pidof $1 >/dev/null; do
            sleep 1
        done
    }

    sleepWhileAppIsUp $DAEMON
end script

post-stop script
    if pidof $DAEMON;
    then
        kill `pidof $DAEMON`
        #pkill  $DAEMON # post-stop process (19300) terminated with status 1
    fi
end script

a similar approach could be taken with pid files.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/406397

Title:
  init: job stuck with expect fork/daemon when parent reaps child

To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/406397/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to