Supervisor.start_link
start_link, go back to Supervisor module for more information.
Specs
start_link([:supervisor.child_spec() | {module(), term()} | module()], [ option() | init_option() ]) :: {:ok, pid()} | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}
start_link(module(), term()) :: on_start()
Starts a supervisor with the given children.
The children is a list of modules, two-element tuples with module and
arguments or a map with the child specification. A strategy is required
to be provided through the :strategy option. See
"start_link/2, init/2, and strategies" for examples and other options.
The options can also be used to register a supervisor name.
The supported values are described under the "Name registration"
section in the GenServer module docs.
If the supervisor and its child processes are successfully spawned
(if the start function of each child process returns {:ok, child},
{:ok, child, info}, or :ignore) this function returns
{:ok, pid}, where pid is the PID of the supervisor. If the supervisor
is given a name and a process with the specified name already exists,
the function returns {:error, {:already_started, pid}}, where pid
is the PID of that process.
If the start function of any of the child processes fails or returns an error
tuple or an erroneous value, the supervisor first terminates with reason
:shutdown all the child processes that have already been started, and then
terminates itself and returns {:error, {:shutdown, reason}}.
Note that a supervisor started with this function is linked to the parent
process and exits not only on crashes but also if the parent process exits
with :normal reason.
Specs
Starts a module-based supervisor process with the given module and init_arg.
To start the supervisor, the init/1 callback will be invoked in the given
module, with init_arg as its argument. The init/1 callback must return a
supervisor specification which can be created with the help of the init/2
function.
If the init/1 callback returns :ignore, this function returns
:ignore as well and the supervisor terminates with reason :normal.
If it fails or returns an incorrect value, this function returns
{:error, term} where term is a term with information about the
error, and the supervisor terminates with reason term.
The :name option can also be given in order to register a supervisor
name, the supported values are described in the "Name registration"
section in the GenServer module docs.