Tail on browser
var http = require("http")
var spawn = require("child_process").spawn;
http.createServer(function(req,res){
var tail = spawn("tail", ["-f", "/var/log/messages"]);
res.writeHead(200,{"Content-Type": "text/plain"});
tail.stdout.on("data", function (chunk) {
res.write(chunk);
});
tail.on("exit", function (status) {
if (status !== 0)
{
console.error("tail exited with code " + status);
exit(1);
}
res.end();
});
}).listen(8000);
Jotted by ishwor Nov. 26, 2010
Comments
No comment posted yetTrackbacks
No trackbacks yetLeave a Reply/Discuss
Developed using djangle
