Hi ALUG,
I have a Python script which seg faults occasionally. Its running on a server so I don't pay it much attention and the seg faults don't matter particularly. But I would like it to be running most of the time.
Does anyone know of a way of making it automatically start again after it has crashed? I guess its kind of like respawning but I don't think I want init to be in control of it.
I guess I could write another script which keeps an eye on the first script's pid and restarts the script when the pid disappears. But before I do, I was wondering if there's a more automatic or more elegant way of doing it?
Cheers, Richard
On Tue, Aug 14, 2007 at 11:07:49AM +0100, Richard Lewis wrote:
I guess I could write another script which keeps an eye on the first script's pid and restarts the script when the pid disappears. But before I do, I was wondering if there's a more automatic or more elegant way of doing it?
Cron job running every half hour to see if it is running and restart it?
Adam
On Tuesday 14 August 2007 13:42:02 Adam Bower wrote:
On Tue, Aug 14, 2007 at 11:07:49AM +0100, Richard Lewis wrote:
I guess I could write another script which keeps an eye on the first script's pid and restarts the script when the pid disappears. But before I do, I was wondering if there's a more automatic or more elegant way of doing it?
Cron job running every half hour to see if it is running and restart it?
Yeah, I guess so.
Though, even dirtier, I just thought I could probably go:
#!/bin/bash
while true do python wobbly-script.py sleep 1 done
Thanks for the suggestion. R.