[systemd-devel] check to see if service is still alive

Reindl Harald h.reindl at thelounge.net
Thu May 26 13:56:56 UTC 2016



Am 26.05.2016 um 14:39 schrieb Thomas Güttler:
> 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

the you *need* to test this outside of the service itself, completly 
rely on a even from inside the service which signals all is fine is a 
broken design when it comes to monitoring - you can't ask the thing 
which you want to monitor if ot works as expectd "do you work as 
expected" - common sense

for our webservers a simple loop with a sleep checks if it responds with 
the expected content and if not calls "systemctl condrestart httpd" to 
not behave bad after a intended service stop

another method would be just send a SIGKILL to the process and use
Restart=always
RestartSec=1

would lead in systemd restarts it automatically

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160526/2487a06e/attachment.sig>


More information about the systemd-devel mailing list