Skip to content

Instantly share code, notes, and snippets.

@arekinath
Created October 18, 2013 05:10
Show Gist options
  • Save arekinath/7036764 to your computer and use it in GitHub Desktop.
Save arekinath/7036764 to your computer and use it in GitHub Desktop.
#!/usr/bin/env escript
%%! -smp enable -pa ebin/ +S 1
do_door() ->
receive
{zdoor, Req, Bin} ->
Line = binary:part(Bin, {0, byte_size(Bin)-1}),
Info = zdoor:req_info(Req),
io:format("line = ~p\ndoor = ~p\n", [Line, Info]),
ok = zdoor:reply(Req, <<"0\n">>),
do_door();
timer ->
io:format("time!\n"),
do_door()
end.
start([]) -> do_door();
start([Next | Rest]) -> ok = zdoor:open(Next, "_joyent_sshd_key_is_authorized"),
start(Rest).
main(Zones) ->
timer:send_interval(1000, timer),
start(Zones).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment