diff options
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]} + ]}}. |