Shell output problem

Paul Mooring paul at opscode.com
Fri May 31 14:12:18 MST 2013


passthru is generally used for outputting binary data straight to the browser (like loading an image).  In this case it sounds like what you want is to update the page with the output of a command in real time.  I think rather than trying to refresh or auto-scroll you wold be better off using js (ajax more specifically) to poll another script and edit the DOM in real time.  Do some googling for 'xmlhttprequest' and 'ajax' and you can probably find some examples of this.


Paul Mooring
Operations Engineer
www.opscode.com

________________________________
From: plug-discuss-bounces at lists.phxlinux.org on behalf of Nathan England
Sent: Friday, May 31, 2013 1:58 PM
To: Main PLUG discussion list
Subject: Shell output problem




I have a php script which runs a command that takes a good while to finish, so I have the command running via passthru($cmd); so I can see the output. This works great, with one problem...



The output comes pretty quickly and I have to keep scrolling down the page to see the output.



I want some way to either make the page automatically scroll or refresh the page constantly while the command runs in the background and only shows the latest line of output.



As the bottom of the page has not been reached yet, it seems javascript will not work for me, because I cannot put an id tag of the bottom of the page which has not loaded yet, so javascript doesn't know where to scroll to, unless I'm doing it wrong.



Any advice or help would be great!

--







Regards,



Nathan England



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NME Computer Services http://www.nmecs.com

Nathan England (nathan at nmecs.com)

Systems Administration / Web Application Development

Information Security Consulting

(480) 559.9681


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20130531/20ea16ad/attachment.html>


More information about the PLUG-discuss mailing list