diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2013-03-11 21:46:30 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2013-03-20 06:02:57 -0500 |
commit | 8f0ef8e3744b9d5d7ac208fdfc3ddbd87dd76588 (patch) | |
tree | b30b180883b30f4ea5ceda900cc79c6fec4c5923 /bin | |
parent | d164628b20442f354065955bea4e8b846983ce8b (diff) | |
download | couchdb-8f0ef8e3744b9d5d7ac208fdfc3ddbd87dd76588.tar.gz |
[review] Add a remsh scriptnebraska-merge-candidate
Diffstat (limited to 'bin')
-rw-r--r-- | bin/couchdb.tpl.in | 2 | ||||
-rwxr-xr-x | bin/remsh | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/bin/couchdb.tpl.in b/bin/couchdb.tpl.in index 81bb8b840..709a56e07 100644 --- a/bin/couchdb.tpl.in +++ b/bin/couchdb.tpl.in @@ -231,7 +231,7 @@ start_couchdb () { touch $PID_FILE interactive_option="+Bd -noinput" fi - command="%ERL% $interactive_option $ERL_START_OPTIONS \ + command="%ERL% -sname couchdb $interactive_option $ERL_START_OPTIONS \ -env ERL_LIBS $ERL_LIBS:%localerlanglibdir% -couch_ini $start_arguments -s couch" if test "$BACKGROUND" = "true" -a "$RECURSED" = "false"; then $0 $background_start_arguments -b -r $RESPAWN_TIMEOUT -p $PID_FILE \ diff --git a/bin/remsh b/bin/remsh new file mode 100755 index 000000000..2d06b3792 --- /dev/null +++ b/bin/remsh @@ -0,0 +1,27 @@ +#!/usr/bin/env escript +%%! -hidden -noshell -noinput + +main(_) -> + net_kernel:start([me(), shortnames]), + case net_adm:ping(couchdb()) of + pong -> + Shell = user_drv:start(['tty_sl -c -e',{couchdb(),shell,start,[]}]), + Ref = erlang:monitor(process, Shell), + receive + {'DOWN', Ref, _, _, _} -> ok + end, + halt(0); + _ -> + io:format("Error connection to: ~s", [couchdb()]), + halt(1) + end. + + +me() -> + Localhost = net_adm:localhost(), + list_to_atom("couchdb_remsh" ++ os:getpid() ++ "@" ++ Localhost). + + +couchdb() -> + Localhost = net_adm:localhost(), + list_to_atom("couchdb@" ++ Localhost). |