I have a mix tasks that processes some data and continuously outputs results to stdout (using IO.puts
, IO.write
, etc).
To execute the task on server, I would like to run detached process with given mix task, redirecting all output to some file, however I am unable to make it work…
I tried running it with
mix some_task some_arg > my_file.txt &
This executes command in the background, also redirecting the output to given file, but only UNTIL I input some text to the shell, in which case command is stopped (not killed)
I also tried running it with
elixir --detached -S mix some_task some_args > my_file.txt
In this case, output is not redirected to given file (only empty file is created).
Does anyone have any suggestions on how to achieve this?
System: Ubuntu 12.04
shell: bash