Skip to content

Commit

Permalink
WHISTLE-533: write PID file on startup of ecallmgr and whistle_apps; …
Browse files Browse the repository at this point in the history
…remove PID file on graceful stop; ignore pidfiles in git
  • Loading branch information
James Aimonetti committed Aug 23, 2011
1 parent 2d045a0 commit bac5a01
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/error_log
*/ebin/*.beam
*/ebin/*.app
*/priv/*.pid
.eunit
ecallmgr/priv/startup.config
whistle_apps/priv/startup.config
Expand Down
5 changes: 4 additions & 1 deletion ecallmgr/src/ecallmgr_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
%% Helper macro for declaring children of supervisor
-define(CHILD(I, Type, Ref, Args), {Ref, {I, start_link, [{Ref, Args}]}, permanent, 5000, Type, [I]}).

-define(PIDFILE, [code:priv_dir(ecallmgr), "/ecallmgr.pid"]).

%% ===================================================================
%% Application callbacks
%% ===================================================================

start(_StartType, _StartArgs) ->
wh_util:write_pid(?PIDFILE),
ecallmgr:start_link().

stop(_State) ->
ok.
ok = file:delete(?PIDFILE).
1 change: 1 addition & 0 deletions whistle_apps/src/whistle_apps.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ start_link() ->
%% @spec start() -> ok
%% @doc Start the callmgr server.
start() ->
start_deps(),
application:start(whistle_apps).

start_deps() ->
Expand Down
5 changes: 4 additions & 1 deletion whistle_apps/src/whistle_apps_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
%% Application callbacks
-export([start/2, stop/1]).

-define(PIDFILE, [code:priv_dir(whistle_apps), "/whistle_apps.pid"]).

%% ===================================================================
%% Application callbacks
%% ===================================================================

start(_StartType, _StartArgs) ->
wh_util:write_pid(?PIDFILE),
whistle_apps:start_link().

stop(_State) ->
ok.
ok = file:delete(?PIDFILE).

0 comments on commit bac5a01

Please sign in to comment.