Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 54 lines (40 sloc) 1.86 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
%%% File : yaws_sup_restarts.erl
%%% Author : Claes Wikstrom <klacke@hyber.org>
%%% Description : Procs that can be restarted
%%% Created : 13 Jan 2009 by Claes Wikstrom <klacke@hyber.org>

-module(yaws_sup_restarts).

-behaviour(supervisor).

%% External exports
-export([start_link/0]).

%% supervisor callbacks
-export([init/1]).


%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

%%%----------------------------------------------------------------------
%%% Callback functions from supervisor
%%%----------------------------------------------------------------------

%%----------------------------------------------------------------------
%%----------------------------------------------------------------------
init([]) ->
    Sess = {yaws_session_server, {yaws_session_server, start_link, []},
            permanent, 5000, worker, [yaws_session_server]},
    YawsRSS = {yaws_rss,
               {yaws_rss, start_link, []},
               permanent, 5000, worker, [yaws_rss]},


    YawsEventManager = {yaws_event_manager,
                        {gen_event, start_link,[{local,yaws_event_manager}]},
                        permanent, 5000, worker, [gen_event]},


    %% below, ignore dialyzer warning:
    %% "The pattern 'false' can never match the type 'true'"
    SendFile = case yaws_sendfile:enabled() of
                   true ->
                       [{yaws_sendfile,
                         {yaws_sendfile, start_link, []},
                         permanent, 5000, worker, [yaws_sendfile]}];
                   false ->
                       []
               end,


    {ok,{{one_for_one, 1, 60}, [Sess, YawsRSS, YawsEventManager] ++ SendFile}}.
Something went wrong with that request. Please try again.