View Single Post

  #11  
Old 06-30-2008, 11:59 AM
Default Re: How to get an "alert" when a process dies

Robert Nichols wrote:
> 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.
>


Put a pause in there, of say a second, your script is going to hoover up
whatever CPU is available for itself.
Reply With Quote