How to get an "alert" when a process dies

This is a discussion on How to get an "alert" when a process dies within the Security forums, part of the Help category; In article , nicc777 wrote: >Is there a way to trigger an event (like running a script) when a >process dies? Perhaps even a script to restart a process if ...

Go Back   Unix Linux Forum > Unix > Linux > Help > Security

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
Reply

 

Thread Tools
  #21  
Old 07-25-2008, 07:39 AM
Default Re: How to get an "alert" when a process dies

In article ,
nicc777 wrote:
>Is there a way to trigger an event (like running a script) when a
>process dies? Perhaps even a script to restart a process if it detects
>that it's dead?


Drop it into inittab. Job done.

Chris
Reply With Quote
  #22  
Old 07-25-2008, 08:15 PM
Default Re: How to get an "alert" when a process dies

nicc777 wrote:

> 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
> process 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?


Wrap it with something like

while [ ! -e /var/run/yourprogram.stop ]; do
yourprogram
sleep 1
done

This restarts the program as long as no file
/var/run/yourprogram.stop exists.



Florian
--

-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------
Reply With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 07:20 AM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger