From 7c5a0789ba80f890c868e81b981315dd53e9dd94 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 29 Apr 2014 16:56:09 +0200 Subject: Turn it all into an application. Warning: Rough edges. --- src/plop_sup.erl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/plop_sup.erl (limited to 'src/plop_sup.erl') 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]} + ]}}. -- cgit v1.1