Restarting scripts
Brian Cole
brianc at temple.edu
Mon Jan 16 16:46:22 EST 2006
If everything dies by a Python exception...
if __name__ == '__main__':
try:
main(sys.argv)
except:
os.execlp("python", "python", sys.argv)
Pretty nasty peice of code, but it works well for restarting your script.
-Brian
On 1/16/06, Ron Griswold <RGriswold at rioting.com> wrote:
>
>
>
> This may be a little OT, but it does involve python scripts. I've written a
> server that hosts my companies asset management system. Of course something
> like this cannot be down for very long without data being lost (of course I
> have taken measures to inform the user of the down time and ask them nicely
> to please try again later… but in the real world people will just bypass the
> system and save manually). So what I need is some facility to start the
> server, and if it goes down, automatically start it back up again.
>
>
>
> If anyone has any ideas on how I might accomplish this, either with python
> code, or third party software, I'd love to hear about it.
>
>
>
> Thanks,
>
>
>
> Ron Griswold
>
> Character TD
>
> R!OT Pictures
>
> rgriswold at rioting.com
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
More information about the Python-list
mailing list