![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|