diff options
author | Linus Nordberg <linus@nordu.net> | 2014-04-29 16:56:09 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2014-04-29 16:56:09 +0200 |
commit | 7c5a0789ba80f890c868e81b981315dd53e9dd94 (patch) | |
tree | a68cc11778fe4ea56ddb0bbaf9709960c0e71bcb /src/plop_sup.erl | |
parent | 73a6c28e22991f2f6dc0ab303c1c5274f083de77 (diff) |
Turn it all into an application.
Warning: Rough edges.
Diffstat (limited to 'src/plop_sup.erl')
-rw-r--r-- | src/plop_sup.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plop_sup.erl b/src/plop_sup.erl new file mode 100644 index 0000000..18ed926 --- /dev/null +++ b/src/plop_sup.erl @@ -0,0 +1,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 in 10s. + worker, [plop]}, + {the_db, + {db, start_link, []}, + permanent, + 10000, + worker, [db]} + ]}}. |