包子源 2017-06-28
[Goodbye node-forever, hello PM2][pm2] [pm2]: (http://devo.ps/blog/2013/06/26/goodbye-node-forever-hello-pm2.html)
看了工具的介绍, 觉得蛮方便的, 就是不支持 CoffeeScript 让人有点抓狂:
Github: https://github.com/Unitech/pm2
npm install -g pm2
PM2 觉得 Forever 有一些不好用的地方:
目测比 Forever 好用一些… PM2 是前几个月刚写的, 还不完善: 列出来的计划有:
盗链个截图:
然后本地安装尝试了一下:
➤➤ cat a.js // Generated by CoffeeScript 1.6.3require('http').createServer(function(req, res){return res.end('ok');}).listen(3000);➤➤ pm2 start a.js ⌬ PM2 Configuration:{ script:'a.js', name:'a'}⌬ PM2 You can write the current configuration by adding -w option ⌬ PM2 Process launched ┌────────┬────┬───────┬────────┬───────────┬─────────────────────┬──────────┬────────────────────────────────┐│Script│ id │ PID │ status │Restarted│Last restart │ memory │ err logs │├────────┼────┼───────┼────────┼───────────┼─────────────────────┼──────────┼────────────────────────────────┤│ a.js │0│27515│ online │0│2013-06-2714:16:28│8.469 MB │/home/yong/.pm2/logs/a-err.log │➤➤ pm2 list ⌬ PM2 Process listing ┌────────┬────┬───────┬────────┬───────────┬─────────────────────┬───────────┬────────────────────────────────┐│Script│ id │ PID │ status │Restarted│Last restart │ memory │ err logs │├────────┼────┼───────┼────────┼───────────┼─────────────────────┼───────────┼────────────────────────────────┤│ a.js │0│27515│ online │0│2013-06-2714:16:28│10.102 MB │/home/yong/.pm2/logs/a-err.log │└────────┴────┴───────┴────────┴───────────┴─────────────────────┴───────────┴────────────────────────────────┘⌬ PM2 PM2 log file path :/home/yong/.pm2/pm2.log (type pm2 logs to see log streaming)⌬ PM2 monitoring : a.js [27515][]0%[|||]10.102 MB ➤➤ pm2 kill Daemon killed ➤➤ pm2 logs Launching daemon { online:true, success:true, pid:27553}[PM2 DAEMON (l0)]"/opt/s/demo/a.coffee -省略省略...