On Fri, Oct 17, 2003 at 02:09:53PM +0200, Carlos E. R. wrote:
The 03.10.16 at 17:54, Kastus wrote:
However, the parent script doesn't exit till the child exits.
Wrong.
No, I'm not. I run an ip-up.local script calling another script (with &):
/etc/ppp/ip-up.local.doit &
and it doesn't _exit_ till the child exits. I tried hard, some years ago. As a hack - I was tired of trying many combinations - I'm doing it as:
at -f /etc/ppp/ip-up.local.doit now
and it works.
I would advise to look into your ip-up.local.doit script, there might be something wrong inside it.
Here is an example. [...] So parent script does not wait for the child to exit.
That doesn't prove my point. The first script executes completely, yes. But it doesn't _exit_ till the child exits!
Mind the word: "exit". Not finishing execution, but exiting completely, freeing the ID, not showing as running process. Parent processes usually wait for children to complete before exiting themselves, or at least, scripts do.
Parent process DOES exit. Please try yourself the following example: a.sh: -------------------------------- #!/bin/bash date echo in a.sh before calling b.sh echo a.sh runs as PID $$ ./b.sh & date echo b.sh started in background ------------------------------- b.sh: ------------------------------ #!/bin/bash echo running sleep... sleep 20 echo back from sleep ----------------------------- kastus@kastus:~> ./a.sh Fri Oct 17 12:21:48 PDT 2003 in a.sh before calling b.sh a.sh runs as PID 6732 Fri Oct 17 12:21:48 PDT 2003 b.sh started in background kastus@kastus:~> running sleep... kastus@kastus:~> ps x |grep 6732 6742 pts/5 S 0:00 grep 6732 kastus@kastus:~> back from sleep kastus@kastus:~> As you see, there is no process running a.sh while b.sh is running in background. If you need help with your /etc/ppp/ip-up.local.doit script, I would be more than happy to help. To contact me privatly substitute NOSPAM with kastus in my address. Regards, -Kastus