![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cvs[commit aborted]:'root is not allowed to commit changes' | rksubash | UNIX for Advanced & Expert Users | 1 | 05-22-2008 05:31 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 12:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 12:06 AM |
| Program received signal SIGABRT, Aborted. | napapanbkk | High Level Programming | 1 | 06-06-2006 07:20 AM |
| BEGIN failed--compilation aborted | abhijeetkul | UNIX for Advanced & Expert Users | 1 | 03-21-2006 12:36 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
rerun a script if aborted and exited
Hello,
When I run a script, the script sometimes exited. I need to re-run it automatically again. Currently I am using crontab to run the script each 5 minutes. However, I need to have a better solution. Any idea what to do? thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
quick Idea came on mind. could be better one. anyway you cna try this
call the script from another script and for value $?. if it failed, you can re-try 'n' times. |
|
#3
|
|||
|
|||
|
If your script sets exit codes (as, in an ideal world, should any process) it is not too hard to use a script wrapper:
First your_script.sh skeleton: Code:
#! /bin/ksh
.... your code ....
if [ ... some condition ...] ; then
print - u2 "Houston, we have a problem. Aborting...."
exit 1 # aborted for some reason
fi
... more of your code ....
exit 0 # normal exit
Code:
#! /bin/ksh
while : ; do
your_script.sh # call your_script.sh
if [ $? -eq 0 ] ; then
break # exit the loop if your_script.sh finished normally
fi
done
exit 0
bakunin |
|
#4
|
|||
|
|||
|
hi melanie,
i guess your problem is that you want to make sure that your script is always running and you use the crontab to check if it does ? As usual there is more that one way. If you need to be fast you can add this script to /etc/inittab very fast but if you are not root you can not do that. Other wise the crontab is ok, check every minute (hour or what you need) if it is running. pidof -x script >/dev/null || nohup script & |
|||
| Google The UNIX and Linux Forums |