
06-30-2008, 10:50 AM
|
Re: How to get an "alert" when a process dies In article ,
nicc777 wrote:
:Hi all,
:
:Even though I use Linux a lot, I have not been doing a lot of hard
:core Linux sysadmin stuff for some time, hence the question here :-)
:
:Is there a way to trigger an event (like running a script) when a rocess dies? Perhaps even a script to restart a process if it detects
:that it's dead?
:
:I have been using cron for monitoring processes up to now, but the
:monitoring interval is 1 minute apart. I have a project (streaming of
:nature) that should not go down, but the problem is that sometimes it
:dies and it takes up to a minute before the traditional monitoring
:script will restart it.
:
:Any ideas?
Can't you just run your process from a simple script that loops,
restarting your process whenever it terminates:
while :
do
myprocess [args ... ]
done
Alternatively, if this process is one that you want to start when the
system boots then you could run it directly from /etc/inittab, using
"respawn" in the action field. If you do that, you'll probably want
to invoke your process via 'su' or else it will be running with root
privileges.
--
Bob Nichols AT comcast.net I am "RNichols42" |