由于某些原因,elixir的pid --detached不等于$!
例如:
elixir --detached -S mix run --no-halt & echo $!和
ps aux | grep 'mix run'输出不同的pids。
这是正常行为吗?我试过nohup,但它有不同的问题。
发布于 2017-07-20 17:23:42
我遇到了同样的问题,并找到了一个解决方案here。
在我的案例中,我最终得到了
$ elixir --detached -e "File.write! 'tmp/pids/bot.pid', :os.getpid" -S mix run --no-halt
$ cat tmp/pids/bot.pid
21352
$ ps aux | grep mix
deployer 21352 50.2 9.1 2234544 45788 ? Sl 12:21 0:02 /usr/lib/erlang/erts-9.0/b它可能看起来很丑陋,但它是有效的:)
https://stackoverflow.com/questions/40898474
复制相似问题