Current section
Files
Jump to
Current section
Files
src/ecrontab_server_sup.erl
-module(ecrontab_server_sup).
-behaviour(supervisor).
-export([
start_link/0,
start_child/0,
init/1
]).
-define(SERVER, ?MODULE).
%%%===================================================================
%%% API functions
%%%===================================================================
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
start_child() ->
supervisor:start_child(?SERVER, []).
%%%===================================================================
%%% Supervisor callbacks
%%%===================================================================
init([]) ->
RestartStrategy = simple_one_for_one,
MaxRestarts = 5,
MaxSecondsBetweenRestarts = 1,
SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},
AChild = {ecrontab_server, {ecrontab_server, start_link, []},
transient, 2000, worker, [ecrontab_server]},
{ok, {SupFlags, [AChild]}}.
%%%===================================================================
%%% Internal functions
%%%===================================================================