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?
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 Post
Re: How to script a continuous loop2006-07-04T04:06:00ZThis is the accepted answer. This is the accepted answer.Hello 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:30ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
- 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.