Sponsored Content
Top Forums Shell Programming and Scripting Script running in parallel failing! Post 302763459 by Don Cragun on Wednesday 30th of January 2013 04:28:08 AM
Old 01-30-2013
Quote:
Originally Posted by Panna
Hi Don Cragun,

Well the script is fetching files from remote location to the local directory through SFTP. The script is correct because it still runs fine for some streams while it fails for others.
Code:
 
for sftp_file_name in `cat remote_file_list_1` #there are 30 file list fetching files from 30 different IP
do 
Code:
fetch_file=`sftp -b $batch_file $remote_user@$remote_IP`
..... ..... done

fetch_file variable would be blank and the script fails to fetch remote file. Note that the remote system is not changed and if I run the script again individually (not when 29 other streams are running simultaneously) then it successfully fetches file from the remote IP!!

Please understand that I won't be able to paste the whole script Smilie but have posted only the snippet (while masking info about user, IP, etc.) where the problem occurs. I hope this is sufficient.

I assumed it to be more of a system issue than code issue and hence didn't post any code with it.......Smilie

Thanks.
I'm sorry, but in my experience, when a programmer tells me that code is correct because it runs fine some of the time, the most likely problem is that that code makes assumptions that are only true some of the time. And, especially when a programmer says his or her multithreaded code is correct because it works correctly when it is tested using a single thread, I have every reason to believe that the program is timing sensitive and any change to the system (added or reduced system load, new hardware, new software, etc.) may affect timing.

You are asking us to tell you why the assignment:
Code:
fetch_file=`sftp -b $batch_file $remote_user@$remote_IP`

is failing without showing us how batch_file, remote_user, and remote_IP are being set. We have no idea what is in remote_file_list_1, but if there are sometimes whitespace characters in that file, it is highly likely that any use of sftp_file_name will fail to do what you intended.

You are not showing us where the problem occurs; you are telling us a line of code sometimes sets a variable to an empty string based on three variables that may have been set incorrectly by code we can't see.

You have the script. If you're convinced it is working correctly and won't let us see what is going on, there isn't anything we can do to help you.

I wish you luck.
 

10 More Discussions You Might Find Interesting

1. Programming

running a parallel program

hi , i need to run a parallel program . for example; program1 { array=" the second program should called here : program 2" the execution should continue } the 2nd program should recieve an array of information as argument and it should... (4 Replies)
Discussion started by: bankpro
4 Replies

2. Shell Programming and Scripting

Running scripts in parallel

Hi, Iam having the scripts as follows. i jus want to run those in parallel. main aim is to minimise the time for overall execution of the script. now out.txt is having 1 lac records. script1(split.sh) split -1000 out.txt splitout ls -A splitout* > filelist.txt cat filelist.txt... (6 Replies)
Discussion started by: nivas
6 Replies

3. IP Networking

running servers parallel

I'm going to undertake a hardware refresh soon and I was wondering if it is possible to run two machines (X and Y) with the same hostname (but different IP addresses) on the same network? Server X is the original server and has an entry in DNS. Server Y is the new server and won't have an entry... (1 Reply)
Discussion started by: soliberus
1 Replies

4. Shell Programming and Scripting

Running shell script in parallel

Hi, I am a shell script which takes input parameters and performs various functions. My concern is, if we call the same shell script with different parameter values from different sessions, will the results be inconsistent? Are there any precautions I need to take inorder to avoid conflicts... (1 Reply)
Discussion started by: jamjam10k
1 Replies

5. Shell Programming and Scripting

Running jobs in parallel

I need to process 50 sqlplus scripts which are listed in a text file. I need to develop a shell script that'll read this file and run these sqlplus scripts. At any point of time, the number of sqlplus scripts running shouldn't exceed 6. If any of the sqlplus scripts completes successfully then... (17 Replies)
Discussion started by: gctex
17 Replies

6. Shell Programming and Scripting

Script running for one iteration and failing the second one

Hi, I am using Tclexpect to automation testing on switches and using regexp and the buffer outputs the program is running well for one iteration and failing the second one... can anyone please guide me what is the mistake i am making? Thanks Here is the small version of the program, while... (2 Replies)
Discussion started by: roh_20022002
2 Replies

7. Shell Programming and Scripting

Running uniq -c and sort -nr in parallel.

Hi All, I have a huge collection of files in a directory about 200000. I have the command below but it only uses one core of the computer. I want it to do task in parallel. This is the command that I want to run in parallel: sort testfile | uniq -c | sort -nr I know how to run sort... (10 Replies)
Discussion started by: shoaibjameel123
10 Replies

8. UNIX for Dummies Questions & Answers

Running parallel process

i am having 4 process,have to run parallel and not after one by one. sample1.sh sample2.sh sample3.sh sample4.sh Thanks in advance. i (11 Replies)
Discussion started by: sagar_1986
11 Replies

9. Shell Programming and Scripting

Running script in Parallel

Hi Folks I have a doubt. I have a script which is running with 2 input parameters ./GetDSLnkCount.sh <jobnumber> Parmfile.txt I need to run the script in parallel for different jobnumbers. The commands are ./GetDSLnkCount.sh jnhuc14500 Parmfile.txt ./GetDSLnkCount.sh jnhuc14501... (3 Replies)
Discussion started by: morbid_angel
3 Replies

10. Shell Programming and Scripting

Running 3 shell script parallel in another shell script

Hi, I'm trying to do teh below thing. I have a single script which uses 3 different parameters to do 3 different work like belwo. test1.sh par1 -- it shuts down an instance test1.sh par2 -- it shuts down an instance test1.sh par3 -- it shuts down an instance Now I created a script... (7 Replies)
Discussion started by: bhaski2012
7 Replies
All times are GMT -4. The time now is 06:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy