Umbrella Scripting(very Urgent)

Hi All,

Can anybody help me to write the umbrella script for the following?

I have three steps to do.

STEP 1: CONVERT XML files to PS files

STEP 2: CONVERT ALL PS FILES TO PDF FILES

STEP 3: FTPING ALL PDF FILES TO THE SERVER.

I have the codes for the above three steps.

Now I want to write such an Umbrella script to integrating the above 3 steps. So that it will execute after STEP 1, STEP 2 and after STEP 2, STEP3.
And if connection will be broken in STEP 2 then it won't go to next STEP 3.
When next time I will start running the script then it should start the doing the jobs from where it is broken??? For example if it is broken in STEP 3 then it will start doing the job from STEP 3.

CAN ANYBODY HELP ME TO WRITE THE UMBRELLA SCRIPT LIKE THE ABOVE REQUIRED SPECIFICATION??????????

IT IS VERY URGENT. If anybody helps me then really I am grateful to that guy.

Can anybody atleast reply to this Problem, plzzzzzzzzzzzzz

#!/bin/ksh
check for control file. if empty then proceed from STEP 1;
if it exists check the last entry & continue ur processing from the next step

status=0
##first set of actions##
if success --> then write a number/status to control file and proceed.
status=1


if [[ status == 1 ]]
then
##execute the second set of actions
if success --> then write a number/status to control file and proceed.
status=2
fi

if [[ status == 2 ]]
then
##execute the third set of actions
#check for failures and process appropriately.
#if success, remove the control file and exit successfully
fi

Hi ranj@chn,

How to check check for control file. if empty then proceed from STEP 1;

I need it very urgently. because Monday is my deadline for doing this Umbrella script.

if [[ ! -s $filename ]]
then
 echo "file is empty"
 exit -1
fi

okay, for you to know whether the command was successful or not, each of the three scripts have to return come sort of code, like 0 for success and nonzero for failure.

then, you write a wrapper like this

#!/bin/sh

#Try doing "step 1" five times
step1timedout=1
for k in 1 2 3 4 5
do

#STEP 1: CONVERT XML files to PS files
convert_xml_files_to_ps.sh #replace this with your command

#get the return code
retcode=$?

#if success, break from loop
if [ $retcode -eq 0]
then
step1timedout=0
break
fi
done

#Check if step 1 timed out
if [ $step1timedout -eq 1]
then
echo "Step 1 failed to execute after 5 tries, aborting execution..."
exit 255
fi

#STEP 2: CONVERT ALL PS FILES TO PDF FILES
#repeat the code for step 1

#STEP 3: FTPING ALL PDF FILES TO THE SERVER.
#repeat the code for step 1

#end of script
exit 0

Note that this is what the script will do:

  1. will try executing step 1. if it is successful, it will proceed for step 2. If step 1 fails after 5 tries, the whole script will exit.
  2. Step 2 will execute with the same logic
  3. Step 3 will execute with the same logic

Now if you want to repeat the whoel process in a loop, you can put the whole thing in a for loop and so it as many times as you like.

Please read Simple Rules of the Unix Forums