[systemd-devel] OT: Which tool to use to restart service if check-script fails

Thomas Güttler guettliml at thomas-guettler.de
Fri May 27 04:48:31 UTC 2016


OK, I understand that I need different tool to restart a service
if a check-script fails.

In my case the check script will be custom code. But the restart stuff
is very general and reusable:

  Step1: Call check-script
  Step2: If exit 0 (meaning service is working), then wait N seconds, got to Step1
  Step3: Service is not working: Send process the signal TERM_SIGNAL (should be configurable)
  Step4: Wait N seconds until process terminated.
  Step5: If process did terminate, restart the service. Wait, go to Step1
  Step6: Process did not terminate: Wait N seconds, Send signal KILL
  Step7: Wait until OS has cleaned up the service
  Step8: Restart the service, Wait, got to Step1

I could implement these steps myself, but I am lazy. I guess this
has already been done several times before.

Any tool recommendation?

Yes, this is off-topic and fits to the current thread :-)

Regards,
   Thomas Güttler


Am 26.05.2016 um 15:15 schrieb Lennart Poettering:
> On Thu, 26.05.16 14:39, Thomas Güttler (guettliml at thomas-guettler.de) wrote:
>
>> Am 26.05.2016 um 14:35 schrieb Andrei Borzenkov:
>>> On Thu, May 26, 2016 at 3:18 PM, Thomas Güttler
>>> <guettliml at thomas-guettler.de> wrote:
>>>> I want to know if the service is alive,
>>>
>>> Define "service is alive".
>>
>> the service is alive if a custom check method has the exit status of 0
>
> That's out of the scope for systemd really. That's monitoring, and I
> am not convinced having custom check function support in systemd is
> really appropriate, this should be implemented outside of systemd
> really.
>
> Lennart
>

-- 
Thomas Guettler http://www.thomas-guettler.de/


More information about the systemd-devel mailing list