简体   繁体   中英

Monitor Java Demon Process using Monit

除了与Monit一起使用PID外,还有另一种方法来监视正在运行的Java进程吗?

You cannot use monit without PID file. If your process does not create a PID file you will have to create a wrapper to start the program and create PID file for monit. See here in official Monit FAQs .

Edit:

Monit has a way other than PID file which is process name. But for this process name should be unique. From the documentation :

  1. CHECK PROCESS [unique name] PIDFILE [path] | MATCHING [regex]

    [path] is the absolute path to the program's pid-file. A pid-file is a file, containing a Process's unique ID. If the pid-file does not exist or does not contain the PID number of a running process, Monit will call the entry's start method if defined.

    [regex] is an alternative to using PID files and uses process name pattern matching to find the process to monitor. The first match is used so this form of check is most useful if the process name is unique. Pid-file should be used where possible as it defines expected pid exactly (pattern matching won't be useful for processes which start a child process using fork/clone as the child will match the same pattern temporarily). You can test if a process match a pattern from the command-line using monit procmatch "regex-pattern". This will lists all processes matching or not, the regex-pattern.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM