<div dir="ltr">I<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"> am currently on vacation but will try to look into this some time later next week when I return.</div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">
<br></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">The stdout/stderr redirection to Erlang is not yet "production" quality - rather an experimental feature introduced last week. I am also working on adding stdin support, so that you could send messages to an OS process's stdin. This should also be available in a week after I return.</div>
</div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">As far as I know erlexec is used in several production systems, and except for the stdout/stderr redirection to Erlang is stable.</div>
</div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">Upon exiting the VM, the erl-exec port process started by exec application receives an end-of-file on the stdin pipe, and sets off the alarm, which guarantees that it'll be killed after a timeout if it hasn't finished the cleanup (termination) of managed processes.  If you don't observe that behavior, please provide more information regarding OS you are running, and ideally some simple test cases.</div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 7, 2013 at 3:36 AM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Created a complete test-case example of my issue with erlexec, and I ran this same script on 3 different computers running variations of debian versions.  Feel free to toss in application:start(sasl), at the top of the erlang script area if you wish, and yes the (minecraft) server software uses stderr instead of stdout, no I do not know why, and yes as you can see it does not return anything to the erlang system until it is killed on all the systems I tested.  Using Erlang's ports you get each line as a message as that is how the server flushes it and it is instant.<div>


<br></div><div><br></div><div>Yes it is ugly, but it is pared down from what it grew from and no need to re-do the receive's better in such a test.</div><div>test_exec_mc.sh</div><div>"""</div><div><div>


#!/bin/sh</div><div><br></div><div>[ -d erlexec ] || git clone <a href="https://github.com/saleyn/erlexec.git" target="_blank">https://github.com/saleyn/erlexec.git</a></div><div><br></div><div>cd erlexec</div><div><br></div>
<div>rebar compile</div>

<div><br></div><div>[ -f 'minecraft_server.1.6.2.jar' ] || wget '<a href="https://s3.amazonaws.com/Minecraft.Download/versions/1.6.2/minecraft_server.1.6.2.jar" target="_blank">https://s3.amazonaws.com/Minecraft.Download/versions/1.6.2/minecraft_server.1.6.2.jar</a>'</div>


<div><br></div><div>erl -pa $PWD/ebin -eval '</div><div>application:start(exec),</div><div>{_, P, _} = exec:run_link("java -Xms1G -Xmx1G -jar minecraft_server.1.6.2.jar nogui", [{stdout, self()}, {stderr, self()}]),</div>


<div>timer:sleep(1000),</div><div>receive A0 -> io:format("Message ~p: ~p~n", [now(), A0]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A1 -> io:format("Message ~p: ~p~n", [now(), A1]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A2 -> io:format("Message ~p: ~p~n", [now(), A2]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A3 -> io:format("Message ~p: ~p~n", [now(), A3]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A4 -> io:format("Message ~p: ~p~n", [now(), A4]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>timer:sleep(1000),</div><div>receive A5 -> io:format("Message ~p: ~p~n", [now(), A5]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A6 -> io:format("Message ~p: ~p~n", [now(), A6]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A7 -> io:format("Message ~p: ~p~n", [now(), A7]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A8 -> io:format("Message ~p: ~p~n", [now(), A8]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A9 -> io:format("Message ~p: ~p~n", [now(), A9]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>timer:sleep(10000),</div><div>receive A10 -> io:format("Message ~p: ~p~n", [now(), A10]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A11 -> io:format("Message ~p: ~p~n", [now(), A11]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A12 -> io:format("Message ~p: ~p~n", [now(), A12]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A13 -> io:format("Message ~p: ~p~n", [now(), A13]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A14 -> io:format("Message ~p: ~p~n", [now(), A14]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>exec:kill(P, 9),</div><div>receive A15 -> io:format("Message ~p: ~p~n", [now(), A15]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A16 -> io:format("Message ~p: ~p~n", [now(), A16]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A17 -> io:format("Message ~p: ~p~n", [now(), A17]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A18 -> io:format("Message ~p: ~p~n", [now(), A18]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A19 -> io:format("Message ~p: ~p~n", [now(), A19]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>timer:sleep(1000),</div><div>receive A20 -> io:format("Message ~p: ~p~n", [now(), A20]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A21 -> io:format("Message ~p: ~p~n", [now(), A21]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A22 -> io:format("Message ~p: ~p~n", [now(), A22]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>receive A23 -> io:format("Message ~p: ~p~n", [now(), A23]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div>


<div>receive A24 -> io:format("Message ~p: ~p~n", [now(), A24]) after 1000 -> io:format("timeout ~p~n", [now()]) end,</div><div>q().'</div></div><div>"""</div><div><br></div><div>


<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 6, 2013 at 10:49 PM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Excepting this, is there any other better way to launch a program as another user?  I might just use ssh certs and ssh to localhost if not unless any other ideas?</div>


<div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Aug 6, 2013 at 4:22 AM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div dir="ltr">I have been attempting to use ErlExec as I noticed that it had a few new features added six days ago to forward the stdout/stderr to an Erlang PID, however I am having some issue.  The process that erlexec runs occasionally does not die when the Erlang VM dies, thus keeping it and its children running.<div>




<br></div><div>Also I need a way to send commands back to the children, but I am either not seeing a command for that or have not figured out the format to send a message, which is difficult because of the main issue I have, when I have it launch a fairly large server software (that is not a daemon for whatever reason, hence why I am wrapping it), the Erlang shell seems to lose a great deal of input that I type in, only catching from every 1 in 4 I type to 1 in 400 characters I type, and it does not seem to matter based on the speed I hit keys or holding a key or anything of the sort, just purely on keypress down, and it remains like that until I kill the child process that I started through erlexec.</div>




<div><br></div><div>Using the normal Erlang Ports works fine and has no such issues (other than the child not coming down with the VM either and no direct kill command when the child hangs, which it occasionally does, but os:cmd("kill ...") works around that well enough.</div>




<div><br></div><div>Is ErlExec stable enough for high use?  Or am I doing something wrong?</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>