Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require('http');
- var spawn = require('child_process').spawn;
- http.createServer(onRequest).listen(4000);
- function onRequest(request, response)
- {
- response.writeHead(200, {'Content-Type' : 'text/plain'});
- var tail_child = spawn('tail', ['-f', '/var/log/system.log']);
- //request.connection.on('end', function() {tail_child_kill();});
- tail_child.stdout.on('data', function(data) {
- console.log(data.toString());
- response.write(data);
- });
- }
- function onData(data)
- {
- console.log(data.toString());
- response.write(data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement