Skip to content

Commit

Permalink
Add --pidfile to start command for writing a PID file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Staubo authored and Cliff Moon committed Jun 4, 2009
1 parent aeb38d8 commit 8a8af11
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,3 +15,4 @@ priv/*.so
c/*.o
build/*
releases/dynomite-*
*.pid
6 changes: 6 additions & 0 deletions elibs/dynomite_app.erl
Expand Up @@ -34,6 +34,12 @@
%% @end
%%--------------------------------------------------------------------
start(_Type, []) ->
case application:get_env(pidfile) of
{ok, Location} ->
Pid = os:getpid(),
ok = file:write_file(Location, list_to_binary(Pid));
undefined -> ok
end,
case application:get_env(config) of
{ok, ConfigFile} ->
case filelib:is_file(ConfigFile) of
Expand Down
5 changes: 5 additions & 0 deletions rlibs/cli/start.rb
Expand Up @@ -30,6 +30,10 @@
opts.on('-d', "--detached", "run detached from the shell") do |detached|
options[:detached] = '-detached'
end

opts.on('-p', "--pidfile PIDFILE", "write pidfile to PIDFILE") do |pidfile|
options[:pidfile] = %Q(-dynomite pidfile "'#{pidfile}'")
end
end.parse!

cookie = Digest::MD5.hexdigest(options[:cluster] + "NomMxnLNUH8suehhFg2fkXQ4HVdL2ewXwM")
Expand All @@ -51,6 +55,7 @@
-setcookie #{cookie} \
#{options[:startup]} \
#{options[:detached]} \
#{options[:pidfile]} \
#{options[:profile]}"
puts str
exec str
Expand Down

0 comments on commit 8a8af11

Please sign in to comment.