Packages
erlexec
1.6.0
2.3.4
2.3.3
retired
2.3.2
retired
2.3.1
retired
2.3.0
retired
2.2.4
retired
2.2.3
retired
2.2.2
retired
2.2.1
retired
2.2.0
retired
2.0.8
retired
2.0.7
retired
2.0.6
retired
2.0.5
retired
2.0.4
retired
2.0.3
retired
2.0.2
retired
2.0.1
retired
2.0.0
retired
1.21.0
retired
1.20.1
retired
1.20.0
retired
1.19.1
retired
1.19.0
1.18.11
1.18.8
1.18.7
1.18.6
1.18.5
1.18.4
1.18.3
1.18.2
1.18.1
1.17.6
1.17.5
1.17.3
1.16.4
1.10.9
1.10.4
1.10.2
1.10.1
1.10.0
1.9.5
1.9.4
1.9.3
1.9.2
1.9.1
1.9.0
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.4.0
1.3.0
1.2.2
1.2.1
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
retired
OS Process Manager
Current section
Files
Jump to
Current section
Files
src/exec_app.erl
%%%------------------------------------------------------------------------
%%% File: $Id$
%%%------------------------------------------------------------------------
%%% @doc This module implements application and supervisor behaviors
%%% of the `exec' application.
%%% @author Serge Aleynikov <saleyn@gmail.com>
%%% @version $Revision: 1.1 $
%%% @end
%%%----------------------------------------------------------------------
%%% Created: 2003-06-25 by Serge Aleynikov <saleyn@gmail.com>
%%% $URL$
%%%------------------------------------------------------------------------
-module(exec_app).
-author('saleyn@gmail.com').
-id ("$Id$").
-behaviour(application).
-behaviour(supervisor).
%% application and supervisor callbacks
-export([start/2, stop/1, init/1]).
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
%%----------------------------------------------------------------------
%% This is the entry module for your application. It contains the
%% start function and some other stuff. You identify this module
%% using the 'mod' attribute in the .app file.
%%
%% The start function is called by the application controller.
%% It normally returns {ok,Pid}, i.e. the same as gen_server and
%% supervisor. Here, we simply call the start function in our supervisor.
%% One can also return {ok, Pid, State}, where State is reused in stop(State).
%%
%% Type can be 'normal' or {takeover,FromNode}. If the 'start_phases'
%% attribute is present in the .app file, Type can also be {failover,FromNode}.
%% This is an odd compatibility thing.
%% @private
%%----------------------------------------------------------------------
start(_Type, _Args) ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
%%----------------------------------------------------------------------
%% stop(State) is called when the application has been terminated, and
%% all processes are gone. The return value is ignored.
%% @private
%%----------------------------------------------------------------------
stop(_S) ->
ok.
%%%---------------------------------------------------------------------
%%% Supervisor behaviour callbacks
%%%---------------------------------------------------------------------
%% @private
init([]) ->
Options =
lists:foldl(
fun(I, Acc) -> add_option(I, Acc) end,
[], [I || {I, _} <- exec:default()]),
{ok, {
{one_for_one, 3, 30}, % Allow MaxR restarts within MaxT seconds
[{ exec, % Id = internal id
{exec, start_link, [Options]}, % StartFun = {M, F, A}
permanent, % Restart = permanent | transient | temporary
10000, % Shutdown - wait 10 seconds, to give child processes time to be killed off.
worker, % Type = worker | supervisor
[exec] % Modules = [Module] | dynamic
}]
}}.
add_option(Option, Acc) ->
case application:get_env(erlexec, Option) of
{ok, Value} -> [{Option, Value} | Acc];
undefined -> Acc
end.