[SOLVED] Only half my script runs | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

[SOLVED] Only half my script runs

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-30-2012
vsekvsek vsekvsek is offline
Registered User
 
Join Date: Nov 2010
Last Activity: 6 May 2013, 10:03 AM EDT
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Only half my script runs

Hello out there, I got this script that runs partly fine by my crontab. Problem is it gets to the sleep 300(which should be 5 minutes right?) part and never runs the rest of the scripts past that. All individual scripts run just fine. My var/mail file only shows it up to the " echo "Loader Stop complete." part and nothing after that.
Do I need to break this out to a stop and then start script called seperately by the crontab or am I doing something wrong in this script here?


Code:
#!/usr/bin/bash
. /export/home/ip/.profile
  
 stop
echo "Webapp Stop complete."
. $HOME/bin/setEnvironmentVars.sh
$BIN_DIR/stopworkers.sh
echo "Workers Stop complete."
 
. $HOME/bin/setEnvironmentVars.sh
thisbranch=`$PRIVATE_DIR\/getBranchCode.sh`
DATA_DIR=/prod/app/$LOGNAME/data/
 
pid=`$PRIVATE_DIR/\checkLoaders.sh`
if [ "$pid" = '' ] ; then
        echo "No IP Loader is running."
    exit 0
fi 
   echo " Killing process " $pid
   echo "  Aborting IP Loader..."
     kill -9 $pid 
   sleep 3
  exit 1;
      
 echo "Loader Stop complete."
sleep 300  
 
echo "Re-Starting Workers and loader and webApp.. "
start
 
 
$BIN_DIR/startworkers.sh

$IPWORKER_HOME/bin/startLoader.sh


Last edited by joeyg; 11-30-2012 at 02:19 PM.. Reason: Please wrap data and sripts with CodeTags
Sponsored Links
    #2  
Old 11-30-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 22 October 2014, 6:34 PM EDT
Location: Saskatchewan
Posts: 19,649
Thanks: 818
Thanked 3,344 Times in 3,132 Posts
Maybe it can't find sleep in its path, that's the kind of error you often get in cron, try /usr/bin/sleep instead (or whatever path it happens to have on your system)
Sponsored Links
    #3  
Old 11-30-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 22 October 2014, 8:12 PM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
I don't even know how it is printing Loader Stop complete.!! because I see an exit call right before this step and it is called without any condition check!

Code:
kill -9 $pid 
sleep 3
exit 1;

echo "Loader Stop complete."

Can you please recheck this step?

Last edited by Yoda; 11-30-2012 at 03:16 PM..
    #4  
Old 11-30-2012
vsekvsek vsekvsek is offline
Registered User
 
Join Date: Nov 2010
Last Activity: 6 May 2013, 10:03 AM EDT
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bipinajith View Post
I don't even know how it is printing Loader Stop complete.!! because I see an exit call right before this step and it is called without any condition check!

Code:
kill -9 $pid 
sleep 3
exit 1;
 
echo "Loader Stop complete."

Can you please recheck this step?
your right I was reading it wrong. That seems to be my issue. thanks guys
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script sortof half-working? hot_pants Shell Programming and Scripting 4 02-18-2009 12:32 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
My script runs too slow :-(... roybe UNIX for Advanced & Expert Users 0 06-13-2005 12:54 PM



All times are GMT -4. The time now is 05:22 AM.