简体   繁体   中英

How to run a non-OTP Erlang application on a remote server with nohup?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM