[Tutor] how to run a process forever

W W srilyk at gmail.com
Wed Dec 10 19:34:32 CET 2008


while True:
is also a common way to make your program "run forever". Although you still
need to create some sleep/wait function or it will eat up your available
processes (so I'm told).

-HTH,
Wayne

On Wed, Dec 10, 2008 at 12:28 PM, Steve Willoughby <steve at alchemy.com>wrote:

> On Wed, Dec 10, 2008 at 12:23:48PM -0600, shawn bright wrote:
> > Hey gents,
> >
> > I have an interesting problem. I need to have a python script start
> > when a computer boots up, and i need it to run forever.
> > I also am going to run a script by cron that will check to see if the
> > process is running, if not, i need a python script to execute
> > the script.
>
> Maybe I'm misunderstanding your meaning, but usually programs which do
> this don't do anything unusual other than... well... simply run forever
> in the background (launched from the startup scripts or cron, disassociated
> from any TTY, of course).  A watchdog re-launcher cron script is also
> not uncommon.
>
> If your script isn't actively doing something it's good to put it to
> sleep until some interesting event (or timer) wakes it up.
>
> Was there something beyond that you were looking for?
>
> --
> Steve Willoughby    |  Using billion-dollar satellites
> steve at alchemy.com   |  to hunt for Tupperware.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081210/1e97b15e/attachment.htm>


More information about the Tutor mailing list