![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| If statement - How to write a null statement | april | Shell Programming and Scripting | 3 | 04-16-2008 02:14 PM |
| Need to execute the same statement | Legend986 | Shell Programming and Scripting | 8 | 10-01-2007 05:59 PM |
| How do i execute in IF ELSE Statement | laknar | Shell Programming and Scripting | 1 | 06-08-2007 03:54 AM |
| Script does not execute Insert Statement | Amruta Pitkar | Shell Programming and Scripting | 4 | 08-25-2006 12:14 AM |
| How can I get an if statement to execute based on number of lines in a file? | LordJezo | Shell Programming and Scripting | 6 | 05-14-2004 11:50 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Controling a statement to execute
Hi All I have a script which runs a piece of JOB. The jobs are in sequence and if it fails at a particular job I wanted it to be started from the point where it failed. What I did I prepared two properties file one which contains the entire List of the JOBS which are to be executed and the other in which I maintain the jobs which are successfully executed. Before executing these jobs I check if its already executed and if so then I Skip the step. The property file is having entry like EODJOB=6000 EODJOB=6001 EODJOB=6002 ....... The script is as follows ############################################# Code:
#! /usr/bin/ksh
# A test to automate the whole EOD
echo "Starting FX Front Office EOD..."
brn_num=$1
set -e on
echo "Running FX Front Office EOD for Branch Number: $brn_num "
echo "Running FX Front Office EOD for Branch Number: $brn_num" > error.txt 2>&1
rootdir=$PWD
fullpropfile=$rootdir/FULL_FX_EOD_JOB.properties
completedpropfile=$rootdir/COMPLETED_FX_EOD_JOB.properties
if [ `grep -c "^EODJOB=" $fullpropfile` -gt 0 ]
then
echo "Running the EOD Process"
for i in `grep "^EODJOB=" $fullpropfile | cut -f2 -d"="`
do
if [ `grep -c "^EODJOB="$i $completedpropfile` -gt 0 ]
then
echo $i Job is already executed for branch =$brn_num and hence skipping the job..........
else
echo executing the job $i for branch=$brn_num
. ./runEod.sh $i $brn_num>> error.txt 2>&1
if [ $# -eq 0 ] #ok execution
then
echo $i Process completed for Branch No:=$brn_num
echo writing into job into completed list
echo 'EODJOB='$i>>COMPLETED_FX_EOD_JOB.properties
fi
fi
done
echo "FX Front Office EOD for Branch Number: $brn_num run successfully"
fi
echo erasing the completed job list
echo "">$completedpropfile
###############################################
The problem is that I am clering the file which contains the completed job entry at the last. And say if a job fails it goes and clear the file. What i need is that only if the entire file is sucessfully executed then only I should clear the file and if the scripts fails in between it should skip this step. Kindly suggest any way Last edited by bakunin; 10-07-2008 at 08:38 PM.. Reason: Please use code-tags when posting scripts. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|