summaryrefslogtreecommitdiff
path: root/src/plop_sup.erl
blob: 3d0e66dc5974e000b61c462b403912c5a45f4080 (plain)
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
-module(plop_sup).
-behaviour(supervisor).

-export([start_link/1, init/1]).
-export([start_in_shell/0]).

start_link(Args) ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, Args).

%% For testing.
start_in_shell() ->
    {ok, Pid} = start_link([]),
    unlink(Pid).

%% Supervisor callback
init(_Args) ->
    {ok, {{one_for_one, 3, 10},
          [{the_plop,
            {plop, start_link, []}, % Here's where key file name and pass phrase go.
            permanent,
            10000,                             % Shut down within 10s.
            worker, [plop]},
           {the_db,
            {db, start_link, []},
            permanent,
            10000,
            worker, [db]}
          ]}}.