I have an Erlang code file which is not an OTP application. I do not use rebar.

My Erlang script just does some calculations and writes result to the file result.txt.

As the running time can be long, I would like to use nohup to run it on a remote machine.

However, running

nohup erl -noshell -pa ebin -eval "my_script:my_fun(Arg1,Arg2)" -s init stop &

does not do anything: nohup.out is created, but remains empty and result.txt is not created at all.

The same command without nohup

erl -noshell -pa ebin -eval "my_script:my_fun(Arg1,Arg2)" -s init stop

works, creating the result.txt file and returning ok.

How can I run my_script.erl through nohup?

有帮助吗?

解决方案

You need to use in your command line the option -detached

http://www.erlang.org/doc/man/erl.html search about "detached"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top