diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2021-01-06 00:20:12 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2021-01-06 00:20:12 +0100 |
commit | 6f026ca26d4015f62d0d5ed639e79d320ece43a1 (patch) | |
tree | 3aff341abdc3ab6e30452e095d21387c98b29927 /src/ejabberd_app.erl | |
parent | XEP-0033 (#3467) (diff) |
Integrate nicely with systemd
Support systemd's watchdog feature and enable it by default in the unit
file, so that ejabberd is auto-restarted if the VM becomes unresponsive.
Also, set the systemd startup type to 'notify', so that startup of
followup units is delayed until ejabberd signals readiness. While at
it, also notify systemd of configuration reload and shutdown states.
Note: "NotifyAccess=all" is required as long as "ejabberdctl foreground"
runs the VM as a new child process, rather than "exec"ing it. This way,
systemd views the ejabberdctl process itself as the main service
process, and would discard notifications from other processes by
default.
Diffstat (limited to '')
-rw-r--r-- | src/ejabberd_app.erl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl index 1473a09c..bdb5e8a5 100644 --- a/src/ejabberd_app.erl +++ b/src/ejabberd_app.erl @@ -58,6 +58,7 @@ start(normal, _Args) -> ejabberd_cluster:wait_for_sync(infinity), ejabberd_hooks:run(ejabberd_started, []), ejabberd:check_apps(), + ejabberd_systemd:ready(), {T2, _} = statistics(wall_clock), ?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs", [ejabberd_option:version(), @@ -96,6 +97,7 @@ start_included_apps() -> %% This function is called when an application is about to be stopped, %% before shutting down the processes of the application. prep_stop(State) -> + ejabberd_systemd:stopping(), ejabberd_hooks:run(ejabberd_stopping, []), ejabberd_listener:stop(), ejabberd_sm:stop(), |