How to generate a Pid-File for an Elixir app
Process IDs are very important in Unix. It’s standard for services to create a file called a “Pid-File” that has the ID of its currently running process so that other applications can discover the PID of the service and manage it. Management tools such as Systemd make heavy use of Pid-Files.
Neither plain mix applications nor Phoenix apps generate Pid-Files by default, but there’s a great drop-in solution in the form of a library called pid_file
.
I made a quick tutorial and screencast that covers setting it up.
Read next An Ueberauth Oauth 2 Walkthrough