View Single Post

  #18  
Old 07-02-2008, 12:18 PM
Default Re: How to get an "alert" when a process dies

On 06/30/2008 04:45 PM, nicc777 wrote:
> On Jun 30, 12:36 pm, Ralf Fassel wrote:
>> * nicc777
>> | 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?
>>
>> #!/bin/sh
>> while true ; do
>> run_your_process
>> status=$?
>> case $status in
>> 0) : probably ok? ; break ;;
>> *) echo "process has exited with status $status, re-run"
>> esac
>> donex
>>
>> ?
>>
>> R'

>
> Cool - not what I expected, but it does work perfectly :-)
>
> I think I was making the problem to complicated.
>
> Thanks a mil


In /etc/inittab:
yp:2345:respawn:/your/bin/script

Don't re-invent the wheel when you don't have to.

Doug
Reply With Quote