Retrying a remote connection after failure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Retrying a remote connection after failure
# 1  
Old 10-14-2010
Retrying a remote connection after failure

Hi all,

I am new to this forum and want an urgent help from you experts. I am currently using SunOs 5.10.

I have a .cfi file which contains some commands to be executed in a node(MSC node in telecom) To connect to a node (for eg node name is MSC1) we have a shell script that has the following command
Code:
/bin/cfi -F /home/scriptdt/scr/script/file.cfi -N MSC1 > outputfile

(cfi utility is invoked from /bin, -F option followed by the path of file.cfi which contains the commands, -N connects to the network element MSC1 and the o/p is stored in outputfile)

there are many lines like this for connecting into different nodes in the script file.

Now the trouble is sometimes due to network issues the connection to the nodes(MSC1 in this case) is not obtained and the execution moves into the next line in the script.So that particular node is missed and results in missing data. I want to retry to the node after some time when all the lines have been performed.

there is an option -b in cfi help list (tries after a delay) but the problem is if i use -b option it gets stuck onto that particular line/Node only and does not proceed to other commands until the connection is obtained and the work is done.

Please help me out how to come out of this situation urgently. I am a newbie to shell scripting.

Moderator's Comments:
Mod Comment Use code tags when posting code, data, logs etc. thanks.


---------- Post updated at 10:22 AM ---------- Previous update was at 10:03 AM ----------

any help?

Last edited by zaxxon; 10-14-2010 at 02:26 AM..
# 2  
Old 10-14-2010
Bumping up threads is not allowed by the forum rules. Also check this:

Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.


Thank you.

The UNIX and Linux Forums
# 3  
Old 10-14-2010
Thanks

Hi Mods,

Thanks for diverting me to the correct thread. However I haven't used urgent or emergency words in the title of the thread.

Being new it will take me few days to get used to this highly valuable forum.

Thanks.
Regards Smilie
# 4  
Old 10-14-2010
You did not use in the subject but in your post:
Quote:
I am new to this forum and want an urgent help from you experts
and as the reminder says
Quote:
remove words like "Urgent" etc. (from your subject and post)
Also bumping the thread up after some minutes (if I got the time right), just because no answer was there already, fits to the "urgent" Smilie

Anyway I think you got the message. No problem - keep the Forum Rules in mind and happy posting Smilie
# 5  
Old 10-14-2010
I tried to find some documentation about CFI and the cfi binary, but no success. It maybe apply unix return codes where:
- Return Code = 0 -> Success
- Return Code != 0 -> Fail

So you can try this:
Code:
execCFI ()
{
	cfiScript="${1}"
	cfiRunNode="${2}"
	
	# Default number of retries is 5
	numRetries="${3:-5}"
	
	if [ ! -f "${cfiScript}" ]
	then
		echo "ERROR: CFI script is not a valid file: [${cfiScript}]."
		return 1
	fi

	currDateTime=`date +"%Y%m%d-%H%M%S"`
	cfiOutFile=`basename "${cfiScript}"`
	cfiOutputFile="${cfiOutFile}_${currDateTime}"
	
	cfiReturnCode=1
	
	while [ ${cfiReturnCode} -ne 0 -o ${numRetries} -ge 0 ]
	do
		/bin/cfi -F "${cfiScript}" -N "${cfiRunNode}" 1>"${cfiOutputFile}" 2>&1
		cfiReturnCode=${?}
		numRetries=`expr ${numRetries} - 1`
	done
        return ${cfiReturnCode}
}

execCFI "/home/scriptdt/scr/script/file.cfi" "MSC1" "5"
execCFIRetCode=${?}

if [ ${execCFIRetCode} -ne 0 ]
then
         echo "ERROR: Failed to execute node: [MSC1]."
fi

I hope it helps.

Regards.
# 6  
Old 10-14-2010
Hi,

Thanks for the reply. I got the work around.

CFI is a utility developed by my employer company and used internally , that is why it can't be found over the net.

Thanks anyways Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote connection

How can we connect to remote computers with a bash script.? (1 Reply)
Discussion started by: diw10
1 Replies

2. Shell Programming and Scripting

Rsync through java program - issues with remote connection failure

Hi Everybody, I am running rsync through my java application. The Java application will sync the files with remote machine. During our connection failure testing we noticed an issue running rsync through java program. The java application which is running at source side is not receiving any... (2 Replies)
Discussion started by: MVEERA
2 Replies

3. Shell Programming and Scripting

Success/failure status of telnet connection

Hi, I am running a shell script which will spawn the telnet and login. But sometimes, the telnet session itself is not getting spawned. My requirement is, if the telnet session is not spawned, the user must be notified that it failed. Is there any command to capture the status of telnet... (2 Replies)
Discussion started by: merin
2 Replies

4. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

5. Linux

GUI remote connection

Hello, I need a tool for remote GUI connection to Linux machine ,something like remote Desktop in windows?????any help Thanks in advance (4 Replies)
Discussion started by: mm00123
4 Replies

6. UNIX for Dummies Questions & Answers

Intermittent Printer connection failure

Hi There What causes the remote printers on unix to loose its connections to the Unix server Sco 6 Version 7 When pinging the print server from unix is comes up with host not connected, but after a few moments the ping reply is positive Then we do a disable and enable of the said printer... (0 Replies)
Discussion started by: esh
0 Replies

7. UNIX for Advanced & Expert Users

ssh/sftp failure connection

Hello, I just want to ask regarding the meaning of the error that we got using sftp: Connecting to <TARGET SERVER IP>... @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @... (3 Replies)
Discussion started by: james_falco
3 Replies

8. Shell Programming and Scripting

Remote Connection (SSH)

Hello all, I connect usually to one enviornment "dev" daily and then ftp some files to some other enviorment "uat" and then login to "uat" and run some scripts to process these files. I was thinking to automate the process, where running one script from "dev" will complete all task required... (11 Replies)
Discussion started by: RishiPahuja
11 Replies

9. UNIX for Advanced & Expert Users

remote connection

Hi: Can i access my Linux Box from a remote machine, Login and Run a program(eg: netscape) in a particular display number. Assuming i do not have XServer running in my machine Appreciate the help Thanks, Preetham. (5 Replies)
Discussion started by: preetham
5 Replies

10. UNIX for Dummies Questions & Answers

I need remote connection help

I am very new to all of this. I tcsh into a Unix box at work. I receive "hints" from a guy here at work that is helping me without doing everything for me. I need to use rx display to x connect to a remote host. I then need to tell the machine (unsure if he meant mine or the box I connected... (2 Replies)
Discussion started by: noobie_doo
2 Replies
Login or Register to Ask a Question