[Goodbye node-forever, hello PM2][pm2] [pm2]: (http://devo.ps/blog/2013/06/26/goodbye-node-forever-hello-pm2.html)
After reading the introduction of the tool, I think it is quite convenient, but it is a bit crazy that it does not support CoffeeScript:
Github: https://github.com/Unitech/pm2
npm install -g pm2
Features
PM2 thinks that Forever has some disadvantages:
- Limited functionality for logging and monitoring
- Limited process and cluster management
- Aging codebase (Upgrading Node can easily lead to application failure)
Visually, it's easier to use than Forever... PM2 was just written a few months ago, and it's not perfect: The plans listed are:
- Remote administration/status checking,
- Built-in inter-processes communication channel (message bus),
- V8 GC memory leak detection,
- web interface,
- Persistent storage for monitoring data,
- E-mail notification
Demo
Hotlink screenshots:
Then try the local installation:
➤➤ 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 -省略省略...