Advertisement

05.11.2006 at 10:38AM PDT, ID: 21847192
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Undesirable early termination - Bash shell scripting while loop

Asked by lennagy in Linux Programming

Tags: , , ,

I've created a bash shell script that loops through a command file.  This command file performs a range of tasks across a range of servers.

WORKS: If I place 'echo' in front of the commands within the loop, then it will show a simulated execution of all tasks on all servers in the list.

DOESNT WORK: After I remove the 'echo' then it will successfully perform all the tasks for the first server, then never do anything for the subsequent servers!

A heavily edited version for clarity and security of the code is as follows ... ( these are the major utilities used in actual script )

while read recLabel recSourcePath recDestinationServer recDestinationPath recDestinationFile
do
  ssh ${recDestinationServer} mkdir ${recDestinationPath}
  ssh ${recDestinationServer} rm ${recDestinationPath}/*.tar.gz
  rsync -baz -e ssh ${recSourcePath }/${recDestinationFile} username@${recDestinationServer }:${recDestinationPath }
done < ${parmFileList}

... sample parmFileList ...
app1 /opt/app1/data webserver1 /tmp/update 1.tar.gz
app1 /opt/app1/data webserver2 /tmp/update 1.tar.gz
app1 /opt/app2/data appserver1 /tmp/update 3.tar.gz
app1 /opt/app2/data appserver2 /tmp/update 3.tar.gz

Any thoughts?

I've put in place a temporary solution, which was to cut all the loop code and create another script.  I call that script from the loop context with a split of the pid using '&'
This of course works, as parallel; however, I'm still curious why it won't run through the whole parmFileList as this is posted.




Start Free Trial
[+][-]05.11.2006 at 10:54AM PDT, ID: 16660980

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.11.2006 at 12:49PM PDT, ID: 16662022

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2006 at 05:32AM PDT, ID: 16677358

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 06:10AM PDT, ID: 16682015

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2006 at 06:14PM PDT, ID: 16687004

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Linux Programming
Tags: loop, while, bash, shell
Sign Up Now!
Solution Provided By: Nopius
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.17.2006 at 12:27PM PDT, ID: 16702614

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2006 at 05:51PM PDT, ID: 16705167

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.18.2006 at 02:52AM PDT, ID: 16707045

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.18.2006 at 05:48AM PDT, ID: 16708200

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.18.2006 at 05:02PM PDT, ID: 16714196

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.01.2006 at 06:12AM PDT, ID: 16807007

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32