Children of scripts don't stop
I may well be doing something foolish here. Apologies if so. Here's an example 'foo' script:
start on rc2/stop
stop on shutdown
script
/tmp/foo
end script
respawn
Here, /tmp/foo is a shell script just writes some output once a second. If I kill it, it restarts nicely.
If I use 'stop' on the script, however, it kills the shell that is running /tmp/foo, but not /tmp/foo itself. That keeps running. ie, upstart is creating two processes:
6958 /bin/sh -e -c /tmp/fooer
6959 /bin/sh /tmp/fooer
And only the first is killed by 'stop'. I would have expected the child to die at the same time, in the absence of nohups etc, but I may know less about shells than I thought I did.
I can get around it here by using
script
exec /tmp/foo
end script
so the parent shell is replaced. Is that the intended behaviour?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- upstart Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Quentin Stafford-Fraser
- Solved:
- Last query:
- Last reply: