pm2: Advanced, production process manager for Node.js

//run.js
const { exec } = require('child_process')
exec('hexo s',(error, stdout, stderr) => {
if(error){
console.log(`exec error: ${error}`)
return
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
})

pm2 delete all

删除所有进程

pm2 start run.js

启动run.js fork模式

pm2 start run.js -i 2

启动run.js 创建两个进程

待续