Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2002 13:52:12 -0500
From:      George Georgalis <george@galis.org>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        nbari@unixmexico.com, freebsd-isp@FreeBSD.ORG, hackers@FreeBSD.ORG
Subject:   Re: tail -f <file> on webpage
Message-ID:  <20021210185212.GC23550@trot.local>
In-Reply-To: <20021209054521.GB20704@dan.emsphone.com>
References:  <26647.148.243.211.1.1039409754.squirrel@mail.unixmexico.com> <20021209054521.GB20704@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 08, 2002 at 11:45:22PM -0600, Dan Nelson wrote:
>In the last episode (Dec 08), nbari@unixmexico.com said:
>> Hi all
>> 
>> How can i make a tail -f <file> and show the results in a web page with
>> out having to reload the page every N seconds
>> 
>> i am using PHP in a script like:
>> 
>> <?php
>> $error_log = '/var/log/apache/log';
>> passthru ("tail -f  $error_log");
>> ?>
>
>The following 3-line CGI works fine:
>
>#! /bin/sh
>printf "Content-type: text/plain\r\n\r\n"
>tail -f /var/log/messages
>

Unfortunatly if you try that your webserver will quickly fail because
the connection never closes. If your customers can create cgi scripts
they can bring down your server too.

How fast depends on httpd.conf MaxSpareServers, and how quickly you hit
reload.

// George

-- 
GEORGE GEORGALIS, System Admin/Architect    cell: 347-451-8229 
Security Services, Web, Mail,            mailto:george@galis.org 
Multimedia, DB, DNS and Metrics.       http://www.galis.org/george 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021210185212.GC23550>