[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Distinguish crash vs normal restart
From: |
Tino Hendricks |
Subject: |
Re: Distinguish crash vs normal restart |
Date: |
Mon, 6 Jun 2016 10:38:00 +0200 |
> Am 06.06.2016 um 10:31 schrieb Ani A <address@hidden>:
>
>> Does the application leave a pid-file behind in case of crash? Then I would
>> go for that.
>>
>>
>>> Am 03.06.2016 um 08:10 schrieb Ani A <address@hidden>:
>>>
>>> Hello,
>>>
>>> I want to run a script when Monit detects that my application has
>>> _crashed_ (not normal restart) more than 4 times in a given duration.
>>> I saw the following post which uses a temp file hack:
>>>
>>> http://stackoverflow.com/questions/18475834/monit-how-to-identify-crashes-of-a-program-instead-of-restarts
>>>
>>> Is this the only/preferred way? or is there a way to distinguish between
>>> normal
>>> restart (via SysV service restart, in my case) vs crash
>>> [assert()/abort()/exit(!0)] ?
>>>
>
> In my case the pid file isn't written by the daemon itself, its
> created from the
> init script (sysV /etc/init.d script)
So it sounds perfect:
process not running & PID file exists => crash
process not running & PID file does not exist => clean shutdown.
:-)
Take care!
Tino