Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
Iam running a shell script which has about 20 steps , where each step executes some process. Suppose I get some problem and then i need to restart my script but at this time i dont want to execute the steps that went thru fine .. I want the script to restart from the step that had problem. For example if i had problem in 10th step then when i run the shell script it should start from 10th step. one alternative is copy the entire script to a sample script and delete all the 9 steps and run it ,, but i dont want to do something like that . from command prompt itself i want to tell the script to start from 10th step . I would like to know if there is a way .
Iam using AIX 4.3 version

Venkat,
There is no built-in feature. It's just a matter of adding some code to your script. Put each step within an if-statement:
if [ $startpoint -le 3 ] ; then
(your third step code goes here)
fiAn optional parameter to the script will be startpoint. If present, validate that it is a number from 2-20. If not present, initialize it to 1.
To automate that approach: At successful completion of each step, the script can echo the step number to a file, overlaying the previous value, so that it keeps up with its progress, and removes the file at successful completion of step 20. At script startup, if the file is present, it can either automatically resume at the proper place or it can announce that this will be a restart at step n, and ask for confirmation. If multiple executions at the same time are allowed, then you would have to do something to avoid clash of the little control file.
Maybe someone has a different approach?
James

Thanks James , I will try to modify the script as you mentioned and try to run it.
I was trying to know if there is any command or built in feature for this .Venkat

![]() |
The parameter list is too...
|
terminfo programming exam...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |