tags:

views:

28

answers:

1

I need to restart a script when it fails. My script fails because of a Ruby runetime bug which is another issue...

A: 

There might be cleaner ways of doing it, but it seems the obvious way is to have a separate process running that monitors the first one. If it is not running, restart it.

You can enumerate processes and get information about the command line and other details in order to know which script is being run.

Mark Wilkins
Follow up, is this much easier on linux?
Zombies
It is probably about the same amount of work. I don't have the information on how to do it in Linux at my fingertips.
Mark Wilkins
@Zombies: I just had a moment to refresh my memory on the Linux side of it. I *think* the standard way is to enumerate the "files" in /proc. You can use `opendir` to enumerate those and retrieve details.
Mark Wilkins