Computing.Net > Forums > Unix > restart shell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

restart shell script

Reply to Message Icon

Name: Venkat
Date: November 14, 2001 at 10:42:30 Pacific
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: November 14, 2001 at 12:52:48 Pacific
Reply:

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)
fi

An 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


0

Response Number 2
Name: Venkat
Date: November 14, 2001 at 13:53:52 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


The parameter list is too... terminfo programming exam...



Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: restart shell script

Shell Scripting www.computing.net/answers/unix/shell-scripting/8475.html

Variables in Shell SCripting www.computing.net/answers/unix/variables-in-shell-scripting/6020.html

shell script to uninstall java www.computing.net/answers/unix/shell-script-to-uninstall-java-/5976.html