Reputation: 1689
For some reason pid of elixir --detached is not equal to $!
For example:
elixir --detached -S mix run --no-halt & echo $!
and
ps aux | grep 'mix run'
outputs different pids.
Is this normal behaviour? I tried nohup, but it has different problems.
Upvotes: 3
Views: 629
Reputation: 2309
I faced with the same problem and found a solution here.
In my case I end up with
$ 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
It might look ugly but it works :)
Upvotes: 2