I solved a similar problem by installing gnu parallel on my system. It did everything that I wanted, and better than I would have coded. Ali
On Tue, Mar 27, 2012 at 6:37 PM, Mark LaPierre marklapier@aol.com wrote:
Check out the redirection at the end of each command. 1>&2 redirects the standard out of your child command to the standard error which then appears in the parent shell. At the end the last & launches your command into a background shell and then moves on to launch the next command. The redirections don't care if the command ever terminates.
The result is that both commands are launched and the parent shell terminates leaving the standard error attached to the terminal that the parent was launched in.
On 03/27/2012 09:08 PM, bruce wrote:
marklapier@aol.com
hey mark....
what you have, appears to be pretty close to what i had... except my tests never ended... the loops are infinite...
can i do a fpaste and have you take a look at what i have?
-btuce
On Tue, Mar 27, 2012 at 9:00 PM, Mark LaPierremarklapier@aol.com
wrote:
On 03/27/2012 05:25 PM, bruce wrote:
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
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
Hey Bruce,
Do you mean to run these subprograms in parallel or in series?
cat.sh #! /bin/bash
CAT=0 until [ $CAT -eq 10 ] do echo "Inside a dog it's too dark to read. $CAT" CAT=$[$CAT + 1] sleep 2 done
dog.sh #! /bin/bash
DOG=0 until [ $DOG -eq 10 ] do echo "Next to a dog a book is man's best friend. $DOG" DOG=$[$DOG + 1] sleep 2 done
test.sh #! /bin/sh
/home/mlapier/test/dog.sh 1>&2& /home/mlapier/test/cat.sh 1>&2&
[mlapier@mushroom test]$ ./test.sh [mlapier@mushroom test]$ Next to a dog a book is man's best friend. 0 Inside a dog it's too dark to read. 0 Next to a dog a book is man's best friend. 1 Inside a dog it's too dark to read. 1 Next to a dog a book is man's best friend. 2 Inside a dog it's too dark to read. 2 Next to a dog a book is man's best friend. 3 Inside a dog it's too dark to read. 3 Next to a dog a book is man's best friend. 4 Inside a dog it's too dark to read. 4 Next to a dog a book is man's best friend. 5 Inside a dog it's too dark to read. 5 Next to a dog a book is man's best friend. 6 Inside a dog it's too dark to read. 6 Next to a dog a book is man's best friend. 7 Inside a dog it's too dark to read. 7 Next to a dog a book is man's best friend. 8 Inside a dog it's too dark to read. 8 Next to a dog a book is man's best friend. 9 Inside a dog it's too dark to read. 9
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
_______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 3/28/2012 4:39 PM, Mark LaPierre wrote:
On Tue, Mar 27, 2012 at 6:37 PM, Mark LaPierre marklapier@aol.com wrote:
Check out the redirection at the end of each command. 1>&2 redirects the standard out of your child command to the standard error which then appears in the parent shell.
Is anyone using tcsh and can tell me if I am correct in my understanding that "whatever >& whatever.out" catches stdout and stderr?
Thanks, Paul
On 03/29/2012 11:15 AM, Paul Allen Newell wrote:
On 3/28/2012 4:39 PM, Mark LaPierre wrote:
On Tue, Mar 27, 2012 at 6:37 PM, Mark LaPierre marklapier@aol.com wrote:
Check out the redirection at the end of each command. 1>&2 redirects the standard out of your child command to the standard error which then appears in the parent shell.
Is anyone using tcsh and can tell me if I am correct in my understanding that "whatever >& whatever.out" catches stdout and stderr?
You do know that a simple google of your question would provide you with the answer, right? :-)
http://www.bo.infn.it/alice/alice-doc/mll-doc/usrgde/node18.html
is just one of the many responses.... And in it you'd see....
& outfile # redirects stderr & stdout to outfile in csh, Tcsh
On 3/28/2012 8:27 PM, Ed Greshko wrote:
On 03/29/2012 11:15 AM, Paul Allen Newell wrote:
On 3/28/2012 4:39 PM, Mark LaPierre wrote:
On Tue, Mar 27, 2012 at 6:37 PM, Mark LaPierremarklapier@aol.com wrote:
Check out the redirection at the end of each command. 1>&2 redirects the standard out of your child command to the standard error which then appears in the parent shell.
Is anyone using tcsh and can tell me if I am correct in my understanding that "whatever>& whatever.out" catches stdout and stderr?
You do know that a simple google of your question would provide you with the answer, right? :-)
http://www.bo.infn.it/alice/alice-doc/mll-doc/usrgde/node18.html
is just one of the many responses.... And in it you'd see....
& outfile # redirects stderr& stdout to outfile in csh, Tcsh
Ed:
I've done enough googles to be pretty certain I was right (as your link does confirm), but I was asking for a confirm of what knew. Too much reading this thread of "2>&1" and making myself confused.
That being said, your suggested link does give me one better than googling tcsh ... its nice to see the bourne and tcsh version in one place.
Thanks, Paul
On 03/29/2012 11:33 AM, Paul Allen Newell wrote:
I've done enough googles to be pretty certain I was right (as your link does confirm), but I was asking for a confirm of what knew. Too much reading this thread of "2>&1" and making myself confused.
That being said, your suggested link does give me one better than googling tcsh ... its nice to see the bourne and tcsh version in one place.
And you have the power to test too....
echo "Hello" > x
cat x /tmp/nosuchfilehere >& outfile
Look to see what is in outfile....
On 3/28/2012 8:43 PM, Ed Greshko wrote:
On 03/29/2012 11:33 AM, Paul Allen Newell wrote:
I've done enough googles to be pretty certain I was right (as your link does confirm), but I was asking for a confirm of what knew. Too much reading this thread of "2>&1" and making myself confused.
That being said, your suggested link does give me one better than googling tcsh ... its nice to see the bourne and tcsh version in one place.
And you have the power to test too....
echo "Hello"> x
cat x /tmp/nosuchfilehere>& outfile
Look to see what is in outfile....
Ed:
I not only have tested, I've been using it for ages. As I said, I was real certain (I should have stated that as "through googling and testing"). I just wanted a confirm as I got scrambled reading the thread.
I apologize for taking up the bandwidth by asking, Thanks, Paul
On 03/29/2012 11:47 AM, Paul Allen Newell wrote:
I apologize for taking up the bandwidth by asking,
Yeah, it does some like a waste of bandwidth to ask questions to which you already know the answer and then have it read by "hundreds" of people that may feel they want to answer and help....because they really think you've asked a question to which you didn't already know the answer.
On 3/28/2012 8:53 PM, Ed Greshko wrote:
On 03/29/2012 11:47 AM, Paul Allen Newell wrote:
I apologize for taking up the bandwidth by asking,
Yeah, it does some like a waste of bandwidth to ask questions to which you already know the answer and then have it read by "hundreds" of people that may feel they want to answer and help....because they really think you've asked a question to which you didn't already know the answer.
Understood and accepted