OK a trivial test case that demonstrates the behaviour.

/etc/rc.local has:

(/etc/init.d/testscript &) &
sleep 20
exit 0

The executable file /etc/init.d/testscript says:
#!/bin/bash
MYLOGFILE=/home/user/testscript.log

echo Starting testscript at `date` > $MYLOGFILE
echo Show that the script has detached and has a PPID of 1 >> $MYLOGFILE
ps -ef | grep testscript >> $MYLOGFILE
trap "echo script was exited at `date` >> $MYLOGFILE" EXIT

while true; do
        echo testscript in loop at `date` >> $MYLOGFILE
        sleep 1
done

and the output of testscript.log is:
Starting testscript at Wed Apr 8 11:36:27 BST 2009
Show that the script has detached and has a PPID of 1
root      2915     1  0 11:36 tty8     00:00:00 /bin/bash /etc/init.d/testscript
root      2919  2915  0 11:36 tty8     00:00:00 grep testscript
testscript in loop at Wed Apr 8 11:36:27 BST 2009
testscript in loop at Wed Apr 8 11:36:28 BST 2009
testscript in loop at Wed Apr 8 11:36:29 BST 2009
testscript in loop at Wed Apr 8 11:36:30 BST 2009
testscript in loop at Wed Apr 8 11:36:31 BST 2009
testscript in loop at Wed Apr 8 11:36:32 BST 2009
testscript in loop at Wed Apr 8 11:36:33 BST 2009
testscript in loop at Wed Apr 8 11:36:34 BST 2009
testscript in loop at Wed Apr 8 11:36:35 BST 2009
testscript in loop at Wed Apr 8 11:36:36 BST 2009
testscript in loop at Wed Apr 8 11:36:37 BST 2009
testscript in loop at Wed Apr 8 11:36:38 BST 2009
testscript in loop at Wed Apr 8 11:36:39 BST 2009
testscript in loop at Wed Apr 8 11:36:40 BST 2009
testscript in loop at Wed Apr 8 11:36:41 BST 2009
testscript in loop at Wed Apr 8 11:36:42 BST 2009
testscript in loop at Wed Apr 8 11:36:43 BST 2009
testscript in loop at Wed Apr 8 11:36:44 BST 2009
testscript in loop at Wed Apr 8 11:36:45 BST 2009
testscript in loop at Wed Apr 8 11:36:46 BST 2009
script was exited at Wed Apr 8 11:36:27 BST 2009

This shows:
(a) the script was successfully run
(b) the script was successfully detached, and became owned by init (PPID 1)
(c) it continued to run for 20 seconds
(d) the time it terminated coincides with the time the exit 0 is run in 
/etc/rc.local
(e) the 'date' on the exit command is a bit weird. I suspect the trap command 
line is run at the time it is encountered, rather than when the trap condition 
is triggered.

So it seems at the point /etc/rc.local exits, it terminates processes it
has produced, regardless of whether it currently owns them. I was not
seeing this behaviour in Intrepid or Hardy.

-- 
since an upgrade to jaunty the rc.local is not loaded at startup
https://bugs.launchpad.net/bugs/332210
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

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

Reply via email to