On my server I have started a service using a script created by myself.
I want to monitor that process using monit. I didn't see any .pid file for that process in the /var/run directory. How can I monitor that process using monit?
Linux – Monitor a process using monit in ubuntu
linuxmonitmonitoringscripting
Related Topic
- Linux – Using monit for a process that doesn’t background/run as a daemon
- Monit: check process without pidfile
- Linux – How to find the .pid file for a given process
- Ubuntu – Monit — Daemonize non-daemon process
- Linux – Restarting shell script with &disown using Monit
- Awaken monit daemon every few hours for all monitored processes
Best Answer
Remember, it is possible to use Monit to manage a process that does not have a PID file. In newer versions of the utility (which you should have) you can leverage the
matching
directive to check the name of your script. If it's running, try using themonit procmatch yourscriptname
command, i.e.:Keep in mind that monit only tracks the first instance it finds using the procmatch filter.
Your monit code would look something like this:
Also see: monit: check process without pidfile