sensu/sensu-build — pull request #51 by joemiller (2013-04-23 20:06:38+00:00)
Title: improve Sensu systemd stop behavior

Sensu should use KillMode=process with systemd

By default, systemd uses `KillMode=control-group` to stop a service by sending SIGTERM to all processes in the cgroup (systemd creates a cgroup for a service at startup). This means that a restart or stop of a sensu service results in SIGTERM being sent to any running handlers/plugins/etc that were forked by Sensu. This often ends up in checks alerting briefly with 'Failed to run, recevied SIGTERM'.

The proper behavior should be to send SIGTERM only to the sensu service and let it properly cleanup/wait for fork'd checks/handlers to finish.

Worth noting is that systemd will send a SIGKILL if the sensu process does not gracefully exit within `TimeoutStopSec` which is 60s by default. This may be another tweak we can make or let people make in the future.