Signalex v0.0.1 Signalex View Source
Helper for handling OS signals. Usage is simple:
defmodule MyProject.SignalHandler do
use Signalex
def handle_event(:sigterm, state) do
# perform cleanup before the app terminates
{:ok, state}
end
end
By default, only sigusr1
, sigquit
and sigterm
are automatially listened
for. If you want to listen to a different signal, you must specify one or many:
use Signalex, handle: :sigusr2
# or a list
use Signalex, handle: [:sigusr1, :sigusr2]