Erlang Proramming Exercise 12-2: Supervising the Database Server
3 November 2011 Leave a Comment
-module(db_server_sup).
-export([start/0,init/1]).
-behavior(supervisor).
start() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init(_Arguments) ->
DbServerOtp = {db_server_otp, %% Id
{db_server_otp, start, []}, %% child process
permanent, %% restart
30000, %% shutdown (ms)
worker, %% type
[db_server_otp]}, %% required modules
{ok,
{{one_for_all, %% terminate all children and restart
5, %% max of n restarts in MaxSeconds
3600}, %% MaxSeconds (s)
[DbServerOtp]}}. %% child process list
Advertisement