php / scripting question
David Schwartz
newsletters at thetoolwiz.com
Thu Jan 1 13:26:21 MST 2015
Happy New Year, all!
I have a general php/scripting question.
I’ve got a guy working on a php script for me and I want it to create a logfile. Piece of cake. The logfile is being created.
I also want to be able to view the logfile inside of an HTML TEXTBOX in a Wordpress admin page. (That’s just context; the question has nothing to do with WP at all.)
In my mind, it’s essentially what you’d get if you did ‘tail -f logfilename’ and piped it into a circular buffer that’s displayed in an HTML TEXTBOX, using a little javascript to update the contents of the TEXTBOX periodically.
As if the TEXTBOX is just a command shell window that shows the results of the ‘tail -f’ command, but you can’t type into it.
Here’s my question: is it possible to spawn a thread running something like rsh to process a ‘tail -f <fname>’ command and take the output from that and display it in an HTML TEXTBOX as if it were just typed at the command line?
Note that I don’t need an infinite history, just 100 lines or so.
Later on I want to add something like a grep filter so it only displays lines that match a specific ID, but for now we just need to get the log file to show up “live” without causing problems.
The programmer is having coniption fits trying to write some rather complicated php+js code to get this to work, and it’s causing buffer overflows with the code managing the TEXTBOX that’s impacting other stuff.
I’m thinking … what’s wrong with just running a ‘tail -f’ command through a shell and displaying the results in a web page?
That’s the beauty of Linux, right?
Any thoughts?
-David
More information about the PLUG-discuss
mailing list