如何使用 nohup 在远程服务器上运行非 OTP Erlang 应用程序?

发布于 2024-12-16 11:26:23 字数 601 浏览 6 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黎歌 2024-12-23 11:26:23

您需要在命令行中使用选项 -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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文