如何使用 nohup 在远程服务器上运行非 OTP Erlang 应用程序?
我有一个 Erlang 代码文件,它不是 OTP 应用程序。我不使用钢筋。
我的 Erlang 脚本只是进行一些计算并将结果写入文件 result.txt
。
由于运行时间可能很长,我想使用 nohup
在远程计算机上运行它。
但是,运行
nohup erl -noshell -pa ebin -eval "my_script:my_fun(Arg1,Arg2)" -s init stop &
不会执行任何操作:创建了 nohup.out
,但仍为空,并且根本没有创建 result.txt
。
没有 nohup
的相同命令也
erl -noshell -pa ebin -eval "my_script:my_fun(Arg1,Arg2)" -s init stop
可以工作,创建 result.txt
文件并返回 ok。
如何通过 nohup
运行 my_script.erl?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在命令行中使用选项
-detached
http: //www.erlang.org/doc/man/erl.html 搜索“detached”
You need to use in your command line the option
-detached
http://www.erlang.org/doc/man/erl.html search about "detached"