program monitor

sentmemail

Member
Aug 20, 2002
130
0
0
hi,
can i know is it possible to monitor if an application closes and automatically restarts it ?
thanks
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
I wrote a python script to do this in Linux ... not to restart it if it stopped, but to notify me if it exited with an error condition. Basically, start the program with a system call from within the python script, and then catch the return value. If it's != 0, it sends me an email. If you just want to restart it if it stops, you could also moniter the /proc filesystem, either manually or with a ps call.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
python bit should still work. Something like this

#!/usr/bin/python

import os

while 1:
os.system("prog_name_to_keep_running")
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
You can do this with probably any scripting language ... or compiled for that matter. If you want to use python, then yes, you'll have to install it.
 

andrewjm

Senior member
Jun 7, 2002
421
0
0
If you open the file twice, does it open multiple processes? If not, just schedule a task to load that file every hour or whatever, and if its already running, it won't load another, and if it isn't then it'll load it.