![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find Dependent libraries in ELF file? | ravinder.are | Filesystems, Disks and Memory | 3 | 04-04-2008 06:23 AM |
| Dependent Object Framework 0.9 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-04-2008 09:10 PM |
| Script execution dependent upon a file landing in a certain directory | keladar | Shell Programming and Scripting | 3 | 12-27-2007 07:19 PM |
| Editor dependent error? | new2ss | Shell Programming and Scripting | 2 | 02-16-2006 11:18 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Job dependent on other job
Hi All
I am trying to run one command ie grep but I want it should execute only after the completion of a shell script has finished. eg Following is my script : java -mx64m $JAVA_OPTS -Dant.home=$ANT_HOME -classpath $_CLASSPATH org.apache.tools.ant.Main -verbose -buildfile /opt/bea/wls 61/config/dev05/batch_automation/MBPSBatch/scripts/build.xml > /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/lo gs/ant.log 2>&1 & grep -i "BUILD FAILED" /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/logs/ant.log 2>/dev/null rcode=$? ############save the return code here if Failed found it would be 0 if [ $? -ne 0 ] then echo "No failed found run the script abc.sh" . /opt/bea/wls61/config/dev05/batch_automation/MassTransfer/startMassTransfer.sh else echo "Failed encounter ..." mailx -s "[`date`] Failure: Error in script" sdfgg@dgssg.com < /opt/bea/wls61/config/dev05/batch_automation/Mass Transfer/logs/ant.log echo "Error was encountered in your script" | mailx -s "ALERT!!" dsfhjkhdfsjh@dsfjhl.com fi Problem is even though no BUILD FAILED is encountered in ant.log still else part gets executed ie Failed encounter. Please suggest some ways so that it works on the logic....... if build success ,should process if part , if failure should execute else part Thanks Pankaj |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You are submitting the "java -mx64m $JAVA_OPTS..." as a background job. I think if you keep it as a foreground process then grep will be executed only after the "java -mx64m $JAVA_OPTS..." thing.
Plz try and check. ~PG |
|
#3
|
|||
|
|||
|
You can do the following
Code:
#choice 1 java & wait grep #choice 2 java <.....> && grep <..> & # choice if the java build returns a meaningful status code $(status=$(java <... > && echo "OKAY") if [[ $status = "OKAY" ]] ; then echo "Success" else echo "failure" fi ) & wait |
|
#4
|
|||
|
|||
|
Can you check if your script failed atleast once? I mean you might be looking at the same old log file repeatedly. This is my guess. Try and let me know.
|
|
#5
|
|||
|
|||
|
Just user "wait"
Just ues the "wait" command inside your shell script or from command line
ie java -metc etc etc >.../log.file & wait grep BUILD...... /log.file The wait will wait until the back ground process completes before allowing the next command to be executed... |
|||
| Google The UNIX and Linux Forums |