I have a service that is always supposed to be running. I’d like to know when the service ever stops or gets restarted.
I’ve thought about referencing the service’s PID. If it gets restarted, it would get a new pid. So I would like to send an alert or email whenever the pid changes. What’s the least intrusive way to do this?
Right now I have a cron job writing the pid to a file every 5 minutes. Is there a Linux tool that can monitor this file for pid changes? Or should I have some other thing like a Python script running outside somewhere that can pull this file and monitor that way?
Asked by Vince
(1 rep)
Mar 28, 2019, 11:13 PM
Last activity: Jun 19, 2025, 10:04 AM
Last activity: Jun 19, 2025, 10:04 AM