DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Tail Log Output With Node.js
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var spawn = require('child_process').spawn;
var filename = process.ARGV[2];
if (!filename)
return sys.puts("Usage: node <server.js> <filename>");
var tail = spawn("tail", ["-f", filename]);
sys.puts("start tailing");
tail.stdout.on("data", function (data) {
sys.puts(data);
});
// node tail.js development.log




