parallel bash scripts

Mateusz Marzantowicz mmarzantowicz at osdf.com.pl
Tue Mar 27 21:46:49 UTC 2012


W dniu 27.03.2012 23:25, bruce pisze:
> hi.
>
> got a couple of test bash scripts.
>
> dog.sh, cat.sh
> each script runs the underlying php in an endless loop.
>
> I'm trying to figure out how to run the scripts in parallel, from the
> same parent shell script. something like:
>
> test.sh
>
>   dog.sh > &2
>   cat.sh > &2
>
> where dog.sh would be :
> --------------------------------
> while true
> do
>   pgrep dog
>   if [ $? -ne 0 ]
>   then
>     /dog.php
>   fi
> sleep 5
> done
>
> my current tests, run dog.sh, which runs the dog.php ... but the test
> never gets to run cat.sh
>
> thoughts/comments...
>
> thanks
Did you try:

command1 & command2

where command1 and command2 are bash built in commands or scripts (in
your case dog.sh and cat.sh)?


Mateusz Marzantowicz


More information about the users mailing list