I'm trying to use Monit to monitor and send email alerts about a process when it stops running, but I need the location of the PID file for that process. I can find the PID number using the htop
or ps
commands and I thought it would be pretty straightforward to find the PID file from there, but after searching Google and StackExchange I've found nothing to answer my question.
I'm aware of this thread: How to find the .pid file for a given process but found it unhelpful. The answer given just mentioned the usual location of PID files, and it was for Redhat/CentOS-style systems. I'm using Ubuntu, and hoping for a more concrete answer. Isn't there a command that returns the path to the PID file given the PID number?
Thank you!
/var/run
, which is now outdated according to the newest Linux Filesystem Hierarchy Standard (don't forget the thread is 8-9 years old), and replaced by/run
.