Skip to content

Instantly share code, notes, and snippets.

@rlipscombe
Created April 18, 2016 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlipscombe/f1cb1d2fc6820b2fdc6e307e256cc0f6 to your computer and use it in GitHub Desktop.
Save rlipscombe/f1cb1d2fc6820b2fdc6e307e256cc0f6 to your computer and use it in GitHub Desktop.
%% erl -pa deps/exec/ebin -s exec
%%
%% c(exec_sup).
%% {ok, Pid} = exec_sup:start_link().
%%
%% ps -ef | grep sleep
%% killall sleep
%% ps -ef | grep sleep
-module(exec_sup).
-export([start_link/0]).
-behaviour(supervisor).
-export([init/1]).
-export([exec_sleep/0]).
start_link() ->
supervisor:start_link(?MODULE, []).
init([]) ->
{ok, {{one_for_one, 10, 10},
[
{sleep, {?MODULE, exec_sleep, []}, permanent, 5000, worker, [?MODULE]}
]}}.
exec_sleep() ->
{ok, Pid, _} = exec:run_link("/bin/sleep 24h", []),
{ok, Pid}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment