25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00
xmpp.chapril.org-ejabberd/src/ejabberd_sup.erl

94 lines
3.1 KiB
Erlang
Raw Normal View History

%%%----------------------------------------------------------------------
%%% File : ejabberd_sup.erl
%%% Author : Alexey Shchepin <alexey@process-one.net>
%%% Purpose : Erlang/OTP supervisor
%%% Created : 31 Jan 2003 by Alexey Shchepin <alexey@process-one.net>
%%%
%%%
2024-01-22 16:40:01 +01:00
%%% ejabberd, Copyright (C) 2002-2024 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
%%% published by the Free Software Foundation; either version 2 of the
%%% License, or (at your option) any later version.
%%%
%%% This program is distributed in the hope that it will be useful,
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details.
%%%
2014-02-22 11:27:40 +01:00
%%% You should have received a copy of the GNU General Public License along
%%% with this program; if not, write to the Free Software Foundation, Inc.,
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
%%%
%%%----------------------------------------------------------------------
-module(ejabberd_sup).
-author('alexey@process-one.net').
-behaviour(supervisor).
-export([start_link/0, init/1, stop_child/1]).
2019-06-14 11:33:26 +02:00
-define(SHUTDOWN_TIMEOUT, timer:minutes(1)).
2018-03-03 16:05:12 +01:00
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
{ok, {{one_for_one, 10, 1},
[worker(ejabberd_systemd),
worker(ejabberd_hooks),
2018-03-03 16:05:12 +01:00
worker(ejabberd_cluster),
worker(translate),
worker(ejabberd_access_permissions),
worker(ejabberd_commands),
worker(ejabberd_ctl),
2018-03-03 16:05:12 +01:00
worker(ejabberd_admin),
2018-09-27 23:28:34 +02:00
supervisor(ejabberd_listener),
2018-03-03 16:05:12 +01:00
worker(ejabberd_pkix),
worker(acl),
2018-07-05 08:31:55 +02:00
worker(ejabberd_shaper),
2019-06-14 11:33:26 +02:00
supervisor(ejabberd_db_sup),
2018-03-03 16:05:12 +01:00
supervisor(ejabberd_backend_sup),
2019-08-12 11:21:31 +02:00
supervisor(ejabberd_sql_sup),
2018-03-03 16:05:12 +01:00
worker(ejabberd_iq),
worker(ejabberd_router),
worker(ejabberd_router_multicast),
worker(ejabberd_local),
worker(ejabberd_sm),
simple_supervisor(ejabberd_s2s_in),
simple_supervisor(ejabberd_s2s_out),
worker(ejabberd_s2s),
simple_supervisor(ejabberd_service),
2018-03-03 16:05:12 +01:00
worker(ext_mod),
supervisor(ejabberd_gen_mod_sup, gen_mod),
worker(ejabberd_captcha),
worker(ejabberd_acme),
2018-03-03 16:05:12 +01:00
worker(ejabberd_auth),
worker(ejabberd_oauth),
worker(ejabberd_batch)]}}.
2018-03-03 16:05:12 +01:00
-spec stop_child(atom()) -> ok.
stop_child(Name) ->
_ = supervisor:terminate_child(?MODULE, Name),
_ = supervisor:delete_child(?MODULE, Name),
ok.
2018-03-03 16:05:12 +01:00
%%%===================================================================
%%% Internal functions
%%%===================================================================
worker(Mod) ->
{Mod, {Mod, start_link, []}, permanent, ?SHUTDOWN_TIMEOUT, worker, [Mod]}.
supervisor(Mod) ->
supervisor(Mod, Mod).
supervisor(Name, Mod) ->
{Name, {Mod, start_link, []}, permanent, infinity, supervisor, [Mod]}.
simple_supervisor(Mod) ->
Name = list_to_atom(atom_to_list(Mod) ++ "_sup"),
{Name, {ejabberd_tmp_sup, start_link, [Name, Mod]},
permanent, infinity, supervisor, [ejabberd_tmp_sup]}.