PM2启动和管理 jar

1. 编写启动json脚本 start.json

{
  "apps" : {
        "name":"zngw",
        "script":"java",
        "args":[
                "-XX:+UseG1GC",
                "-jar",
                "zngw.jar",
         ],
        "error_file":"./log/err.log",
        "out_file":"./log/out.log",
        "merge_logs":true,
        "log_date_format":"YYYY/MM/DD HH:mm:ss",
                "min_uptime": "60s", 
        "max_restarts": 30,
        "autorestart": true,
                "restart_delay": "60" 
        }
}

2. 启动

pm2 start start.json
0%