bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Running multiple processes using trap and kill -s


From: Sammo
Subject: Running multiple processes using trap and kill -s
Date: Sun, 26 Jun 2005 23:36:44 +1000

2.05b.0(1)-release

I seem to be having problems with one of the examples in the Advanced
Bash Scripting Guide [1]. The script is supposed to start a specified
number of processes, and when each process finishes, it sends a trap
signal, which starts a new process. I think the script is correct, but
it's not working as expected.

This is what is happening: The first process that finishes sends a
trap signal to $$, and a new process is started (as expected). But
when subsequent processes try to send the trap signal, they can't find
the process. Also, seems that the "wait" command is only waiting until
the first process finishes, instead of waiting for all of them to
finish.

Well, here is the output:

$ ./multiple-processes.sh 3
Starting 8 Time:3
Starting 7 Time:1
Starting 6 Time:4
Ending 7
Starting 5 Time:4

$ Ending 8
./multiple-processes.sh: line 37: kill: (3944) - No such process
Ending 6
./multiple-processes.sh: line 37: kill: (3944) - No such process
Ending 5
./multiple-processes.sh: line 37: kill: (3944) - No such process 

Please, can somebody help?!

References:

[1] Example 29-8. Running multiple processes (on an SMP box),
http://www.tldp.org/LDP/abs/html/debugging.html#MULTIPLEPROC




reply via email to

[Prev in Thread] Current Thread [Next in Thread]