The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
why shell script fails tahir23 Shell Programming and Scripting 4 08-21-2008 11:37 AM
#!/bin/sh script fails at StringA | tr "[x]" "[y]" by_tg UNIX for Dummies Questions & Answers 3 02-22-2008 12:17 PM
SCP fails sometimes vipinc AIX 10 07-18-2007 03:38 AM
Shell Script fails with "can't connect to client" sseenu79 HP-UX 2 12-20-2006 10:47 AM
Script fails JStone Shell Programming and Scripting 8 08-10-2006 01:00 AM

Closed Thread
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
  #1 (permalink)  
Old 08-21-2008
tahir23 tahir23 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 25
why script fails sometime?

Hi,


I am trying to run a shell script on solaris,some time it works fine and some times it fails unexpectedly. There is a script called "autostart.sh" which automatically starts the Application server but some times the script fails to strat the application server. can anyone tell me what is the reason , why it dn't work properly .
The Script is ;
____________________________________________
#!/bin/bash
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/ ./startManager.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ .startNode.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ ./startServer.sh server1
/opt/IBM/HTTPServer/bin/ ./apachectl start
_______________________________________________


Thanks in advance.
  #2 (permalink)  
Old 08-21-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
I'm surprised it ever works... why are there spaces between the directory name and the script name? Try making it like this:

Code:
#!/bin/bash
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/startManager.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startNode.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startServer.sh server1
/opt/IBM/HTTPServer/bin/apachectl start
  #3 (permalink)  
Old 08-21-2008
tahir23 tahir23 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 25
Thanks Annihilannic

Code:
#!/bin/bash
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/./startManager.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/.startNode.sh
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/./startServer.sh server1
/opt/IBM/HTTPServer/bin/./apachectl start

.......... Spaces are not in script , i know it will not work if there would be any space, i m sure that there is no error in this scrips and at this time script is running but some time it works and some time no.I have automate and it works on system stratup , I don't know why this problem occurs.

Last edited by bakunin; 08-21-2008 at 04:50 AM.. Reason: Please use "code"-tags when posting a script.
  #4 (permalink)  
Old 08-21-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
When does it work and when does it not work? Does it work when you run it manually, but not when you system boots up? Or is it completely random... i.e. sometimes when you run it manually it works, sometimes it doesn't?
  #5 (permalink)  
Old 08-21-2008
tahir23 tahir23 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 25
Yes it runs manually and at startup as well . but some times it does't start all the services mentioned in the script . On system boot some times it works but some time does't .
  #6 (permalink)  
Old 08-21-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
Quote:
Originally Posted by tahir23 View Post
Yes it runs manually and at startup as well . but some times it does't start all the services mentioned in the script . On system boot some times it works but some time does't .
Do these scripts output any "interesting" information? Do the processes themselves keep logfiles??
  #7 (permalink)  
Old 08-21-2008
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
The scripts mentioned here are the default start scripts for IBMs Websphere product. They themselves run a whole lot of commands and any of these commands can fail for some or the other reason.

In other words: nothing of the information you gave us so far is sufficient to find out the reason. our script calls four other scripts and this process probably never fails and never will fail. That does not mean, though, that all the scripts started this way will finish sucessfully - each of them could fail for some or other reason. I have worked with a server running Websphere once and i know that it can be tricky sometimes to find ot why it failed to start.

I fear it will boil down to thorough troubleshooting on your side to find out the reason. The following are just some (very general) suggestions which may or ma not help you find the problem.

- You run your script under bash instead of ksh. bash is not the systems default shell and hence using it a potential risk. While i suppose it won't make any difference it is on the safer side to use "/bin/ksh" instead of bash.

- Try inserting "set -x" at the start of the four mentioned scripts and capture the output to some file to see what is going on:

Code:
#!/bin/ksh
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/startManager.sh  >/tmp/start.1.log 2>&1
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startNode.sh  >/tmp/start.2.log 2>&1
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startServer.sh server1 >/tmp/start.3.log 2>&1
/opt/IBM/HTTPServer/bin/apachectl start >/tmp/start.4.log 2>&1
If something fails you can analyze the files /tmp/start[1-4].log then. This will not fix any problem itself, just help you analyze the situation when it happens.

I hope this helps.

bakunin
Closed Thread

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 10:59 PM.


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