linux - How to get information from text file using PHP and remote ssh? -


i've got problem poor performance php executing bash script remote ssh , doing grep on log. in web browser receive output after 40 seconds. executing bash script(ssh + grep on remote machine) directly on local machine taking 8 seconds. know cannot bypass came idea of :

creating php script save text file on local machine "variables" need. let's call "parameters.txt". other bash script "reader.sh" read "parameters.txt" file, of magic of remote ssh , grep, save output "output.txt". background script run every 2 seconds reader.sh

is idea?

if need use php on ssh, use http://phpseclib.sourceforge.net/. have nice ssh implementation used sometime deploy applications , configure linux servers (puppet replaced it). code cleaner , easy maintain.

another option is, if reading logs linux ( messages, apache, syslog, etc...) have options rsyslog (http://www.rsyslog.com/) centralize on server , work on locally. cheaper computers , easier deploy.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -