2003-02-01 21:21:28 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
%%% File : ejabberd_sup.erl
|
2007-12-24 12:41:41 +01:00
|
|
|
%%% 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
|
2007-12-24 12:41:41 +01:00
|
|
|
%%%
|
|
|
|
%%% 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.
|
2009-01-12 15:44:42 +01:00
|
|
|
%%%
|
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.
|
2007-12-24 12:41:41 +01:00
|
|
|
%%%
|
2003-02-01 21:21:28 +01:00
|
|
|
%%%----------------------------------------------------------------------
|
|
|
|
|
|
|
|
-module(ejabberd_sup).
|
2007-12-24 12:41:41 +01:00
|
|
|
-author('alexey@process-one.net').
|
2003-02-01 21:21:28 +01:00
|
|
|
|
|
|
|
-behaviour(supervisor).
|
|
|
|
|
2019-07-29 09:46:20 +02:00
|
|
|
-export([start_link/0, init/1, stop_child/1]).
|
2003-02-01 21:21:28 +01:00
|
|
|
|
2019-06-14 11:33:26 +02:00
|
|
|
-define(SHUTDOWN_TIMEOUT, timer:minutes(1)).
|
2018-03-03 16:05:12 +01:00
|
|
|
|
2003-02-01 21:21:28 +01:00
|
|
|
start_link() ->
|
|
|
|
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
|
|
|
|
|
|
|
init([]) ->
|
2003-07-20 22:35:35 +02:00
|
|
|
{ok, {{one_for_one, 10, 1},
|
2021-01-06 00:20:12 +01:00
|
|
|
[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),
|
2024-01-31 16:08:05 +01:00
|
|
|
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),
|
2019-07-15 11:53:26 +02:00
|
|
|
simple_supervisor(ejabberd_s2s_in),
|
|
|
|
simple_supervisor(ejabberd_s2s_out),
|
2019-07-15 11:59:47 +02:00
|
|
|
worker(ejabberd_s2s),
|
2019-07-15 11:53:26 +02:00
|
|
|
simple_supervisor(ejabberd_service),
|
2018-03-03 16:05:12 +01:00
|
|
|
worker(ext_mod),
|
|
|
|
supervisor(ejabberd_gen_mod_sup, gen_mod),
|
2022-12-28 17:11:11 +01:00
|
|
|
worker(ejabberd_captcha),
|
2019-09-20 11:36:31 +02:00
|
|
|
worker(ejabberd_acme),
|
2018-03-03 16:05:12 +01:00
|
|
|
worker(ejabberd_auth),
|
2022-04-08 16:49:24 +02:00
|
|
|
worker(ejabberd_oauth),
|
|
|
|
worker(ejabberd_batch)]}}.
|
2018-03-03 16:05:12 +01:00
|
|
|
|
2019-07-29 09:46:20 +02: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]}.
|