-
-
Save OvermindDL1/1d8ca244db81d9000050 to your computer and use it in GitHub Desktop.
erlexec issues example program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ -d erlexec ] || git clone https://github.com/saleyn/erlexec.git | |
cd erlexec | |
rebar compile | |
[ -f 'minecraft_server.1.6.2.jar' ] || wget 'https://s3.amazonaws.com/Minecraft.Download/versions/1.6.2/minecraft_server.1.6.2.jar' | |
erl -pa $PWD/ebin -eval ' | |
application:start(exec), | |
{_, P, _} = exec:run_link("java -Xms1G -Xmx1G -jar minecraft_server.1.6.2.jar nogui", [{stdout, self()}, {stderr, self()}]), | |
timer:sleep(1000), | |
receive A0 -> io:format("Message ~p: ~p~n", [now(), A0]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A1 -> io:format("Message ~p: ~p~n", [now(), A1]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A2 -> io:format("Message ~p: ~p~n", [now(), A2]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A3 -> io:format("Message ~p: ~p~n", [now(), A3]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A4 -> io:format("Message ~p: ~p~n", [now(), A4]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
timer:sleep(1000), | |
receive A5 -> io:format("Message ~p: ~p~n", [now(), A5]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A6 -> io:format("Message ~p: ~p~n", [now(), A6]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A7 -> io:format("Message ~p: ~p~n", [now(), A7]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A8 -> io:format("Message ~p: ~p~n", [now(), A8]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A9 -> io:format("Message ~p: ~p~n", [now(), A9]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
timer:sleep(10000), | |
receive A10 -> io:format("Message ~p: ~p~n", [now(), A10]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A11 -> io:format("Message ~p: ~p~n", [now(), A11]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A12 -> io:format("Message ~p: ~p~n", [now(), A12]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A13 -> io:format("Message ~p: ~p~n", [now(), A13]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A14 -> io:format("Message ~p: ~p~n", [now(), A14]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
exec:kill(P, 9), | |
receive A15 -> io:format("Message ~p: ~p~n", [now(), A15]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A16 -> io:format("Message ~p: ~p~n", [now(), A16]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A17 -> io:format("Message ~p: ~p~n", [now(), A17]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A18 -> io:format("Message ~p: ~p~n", [now(), A18]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A19 -> io:format("Message ~p: ~p~n", [now(), A19]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
timer:sleep(1000), | |
receive A20 -> io:format("Message ~p: ~p~n", [now(), A20]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A21 -> io:format("Message ~p: ~p~n", [now(), A21]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A22 -> io:format("Message ~p: ~p~n", [now(), A22]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A23 -> io:format("Message ~p: ~p~n", [now(), A23]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
receive A24 -> io:format("Message ~p: ~p~n", [now(), A24]) after 1000 -> io:format("timeout ~p~n", [now()]) end, | |
q().' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment