blob: 2d06b3792bf57124ab8b107622b822905630b6bb [file] [log] [blame]
#!/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).