The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Very Challenging Problem. Please read fully. RRVARMA Shell Programming and Scripting 12 07-20-2008 11:52 AM
A challenging problem involving symbolic links. ibloom High Level Programming 2 03-24-2008 10:07 AM
Challenging!! Help needed hcdiss Shell Programming and Scripting 1 03-02-2008 11:29 PM
A Challenging situation for the MODERATORS BAM UNIX for Dummies Questions & Answers 1 08-18-2002 02:12 PM
Very Challenging Question! Need help bad! Sparticus007 UNIX for Advanced & Expert Users 1 01-07-2002 10:49 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-19-2009
tajdar tajdar is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
Need help in writing a timeout for ssh comands?

Hello All,

I am new to this forum, and the reason I came here is to seek solution from the experts.

I have written following wrapper script, it was running fine from past couple of months, until last week.
When one of the function in the script which suppose to login through ssh to the external server and run the script to start/stop the tibco or http get hanged. The script hanged till 14 hours when it comes to our notice that nothing is running.

Now my problem is that when the script executes the external scripts on which I donot have any control through ssh. It looses the control, and become fully dependent on the external script to pass the control back to my script where I can decide that the external command or scipt ran successfully or not.

Can there be a way by which my script be able to do the following?

1- Able to identify if the external scripts or commands hangs or taking longer time then expected?
2- Able to kill the external commands or script plus all the subsequent scripts and report an error?
3- OR can I built the timeout for each function?

Any help will be highly appreciated as I have tried everything but my Unix skills aren't that good that I could resolve this issue on my own.

Regards
Tajdar




F_STOP_HTTP()
{
# This stops the HTTP server for CRM so no one can log on.
set -x
log_message "Stopping the CRM HTTP server on ${HTTP_HOST}."


su - jxadmin -c "ssh ${HTTP_HOST} '/opt/app/IBMIHS/bin/apachectl -d /opt/app/IBMIHS/ -f /opt/app/IBMIHS/conf/httpd.conf.was${ENV}.ChordiantServerCobal -k stop; echo $?'"

if [[ $? -eq 0 ]]
then
log_message "Success: HTTP server stopped successfully."
else
log_message "Error: HTTP server cannot stop, exiting. Please check the detail Logs."

mail_error
echo `date`": Script Failed Exiting."
exit 1;
fi

}
# ----------------------------------------------------------
# MAIN BIT
# ----------------------------------------------------------

F_STOP_HTTP

## End of Script...
echo `date`": Script Completed Successfully."
exit 0;

Last edited by tajdar; 01-20-2009 at 06:57 AM.. Reason: To make it more elaborative
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0