PM2 monitoring project run Spring Boot

More PM2 usage description please refer to: PM2 Simple Manual - Denver

Since PM2 are usually used for node applications, it exec_modeshould be written fork, the most important thing is args, -jarand the location where the jar package should be marked, if the need to provide additional parameters, but also in the argsnotation, together.

Suppose you create shown below fz.json, use the command pm2 start fz.jsonto run fz.jarusing the command tail -f /home/imzhizi/log/fz-out.logcan also view the run log.

{
    "name": "fz",
    "script": "/usr/bin/java",
    "args": [
        "-jar",
        "/home/imzhizi/tcm-fz/target/fz.jar",
        "--spring.profiles.active=prod"
    ],
    "exec_interpreter": "",
    "exec_mode": "fork",
    "error_file" : "/home/imzhizi/log/fz-err.log",
    "out_file"   : "/home/imzhizi/log/fz-out.log"
}

Some experience:

  1. After passing through json start, you can directly use the name json file to control the project, such as pm2 stop name;
  2. After each re-packaged, use pm2 restart namecan update the project;
  3. If you modify the json file, it can not by restartupdating the project, must first pm2 del nameand then again pm2 start xx.json.

Guess you like

Origin www.cnblogs.com/imzhizi/p/montior-jar-using-pm2.html