Closed imranismail closed 5 years ago
I had the same issue: I removed the PIDFile=...
line and it seems to work well. If I manually stop the process (bin/my_app stop
), systemd restarts it, so it looks like it's actually supervising the app (disclaimer: I'm no systemd expert)
What's managing the PID file, is it writing out the PID of the pre-forked process or something instead of the post-forked process?
if Type=forking
and PIDFile
is not set, the option GuessMainPID
defaults to yes and systemd should refer to the PID of the main process of the daemon after start-up. I hope that answers @OvermindDL1 's question.
I know about when PIDFile is not set, but I was wondering why it was not working on when the PIDFile is set, because if that's not working it sounds like the wrong PID is being written.
The PID that gets written by distillery belongs to the first child (17211) of the daemon process (17210), so I guess systemd expects 17210 instead of 17211.
You should not use start
with systemd, as you've found, it is not really designed for that use and doesn't work reliably because of that. Instead, use foreground
and let systemd manage the process normally, it works very well in my experience.
I'm having trouble trying to get the app to be supervised correctly by
systemd
.App started successfully but whenever it is killed via
pkill beam.smp
it doesn't start back up.Currently running on:
These are the hooks configured:
release_ctl eval --mfa 'ExApp.Tasks.Migration.run/1' --argv -- "$@"
sleep 3
systemd
unit file:systemd
status: