Created
February 25, 2015 09:18
-
-
Save soyuka/ca813a8baf1c8efb7974 to your computer and use it in GitHub Desktop.
pm2 test case #1036
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pm2 start server.js | |
ps -ef|grep 'tail -F ~/.pm2/pm2.log'|grep -v grep|wc -l # gives 1 | |
pm2 stop 0 | |
ps -ef|grep 'tail -F ~/.pm2/pm2.log'|grep -v grep|wc -l # gives 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var spawn = require('child_process').spawn | |
http.createServer(function(req, res) { | |
res.writeHead(200); | |
res.end("hello world\n"); | |
}).listen(8020); | |
var s = spawn('tail', ['-F', '~/.pm2/pm2.log'], {detached: true, stdio: ['ignore', 'ignore', 'ignore']}); | |
//make sure stdio aren't linked to the main process, so that it's detached indeed | |
s.on('close', function() { | |
console.log('Spawn closed') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment