I need to create a script that continually loops. I don't want to use cron to keep re-running a script, but I need a script that I can run from a command line that will continually loop until it is terminated.
Please can I get some suggestions as to how I can accomplish this?
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
5 replies Latest Post - 2009-02-20T19:47:53Z by enriqueaco
Pinned topic How to script a continuous loop
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2009-02-20T19:47:53Z at 2009-02-20T19:47:53Z by enriqueaco
Chandru 120000KT0Y1 PostACCEPTED ANSWER
Re: How to script a continuous loop2006-07-04T04:06:00Z in response to SystemAdminHello Milskin
My understanding about your problem is here.You need to run a script until it terminates not by any session or user logout... If my understanding is wrong leave this...
To achieve this
nohup <cmd> <options>
for more info. see man pages.
Re: How to script a continuous loop2007-08-31T13:49:30Z in response to SystemAdminOr you can combine both ideas:
- Script name: loop_for_ever.sh
while true ; do echo $(date); done
Then you can call it like this:
nohup ./loop_for_ever.sh &
So now nohup makes it immune to hang-ups and the ampersand (&) makes it a backgroud process so you can have use of the shell window again.