3 ms·
If you do end up playing with this, take a look at node.js and socket.io. Here is the relevant part for tailing a file over ssh: var tail = spawn('ssh', ['use
by zackham 16y ago
If you do end up playing with this, take a look at node.js and socket.io. Here is the relevant part for tailing a file over ssh:
var tail = spawn('ssh', ['user@yourserver.com', 'tail', '-f', '/path/to/some.log']);
tail.stdout.addListener('data', function (data) {
listener.broadcast(data.toString());
});
I did a really simple version of what you're talking about with some client-side parsing of rails logs for fun. Feel free to contact me and I'll be happy to zip up the source and send it your way.
- Keyframe 16y agohah, wow - thanks for the effort. Actually, I haven't been very descriptive. I have some apps here and there that take a certain time to execute (often in minutes) running on server. I wanted an easy way to monitor their progress from a web interface without any (or too much) modifications to original code. So what I did now is that basically I've made a 'forever frame' in my html which points to a URI where app resides. That app now outputs multipart/x-mixed-replace MIME which is then loaded into an iframe in my html and JS copied when onLoad happens to a styled div. I've made a small proof of concept here: - here is a straight sample output (in this case a dummy php): http://www.vga.hr/console_test/count.php http://www.vga.hr/console_test/count.php since this is a multipart/x-mixed-replace, I can blurt out a html (as 'Start' is) and plain afterwards. - here is a simple client html: http://www.vga.hr/console_test/con_out.html http://www.vga.hr/console_test/con_out.html - and another one which concatenates: http://www.vga.hr/console_test/con_out_plus.html http://www.vga.hr/console_test/con_out_plus.html so my idea was basically to output text/html <script> out when I need to issue commands to a reader (for commands like overwrite mode, concatenate mode, highlight, clear, flash... whatever - basically a state machine) and text/plain for actual messages being shown. I wish I could get rid of 'loading' status in browser while doing a long poll as primitive as I am now (forever frame). tl;dr; should be on a client side only with x-mixed-replace on server. Thanks again.