From owner-freebsd-hackers Tue Dec 10 21:55:28 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D5F5937B404 for ; Tue, 10 Dec 2002 21:55:26 -0800 (PST) Received: from dynamic.galis.org (ool-4350143e.dyn.optonline.net [67.80.20.62]) by mx1.FreeBSD.org (Postfix) with SMTP id B775E43EA9 for ; Tue, 10 Dec 2002 21:55:25 -0800 (PST) (envelope-from quack@galis.org) Received: (qmail 24046 invoked by uid 1010); 10 Dec 2002 18:52:12 -0000 Date: Tue, 10 Dec 2002 13:52:12 -0500 From: George Georgalis To: Dan Nelson Cc: nbari@unixmexico.com, freebsd-isp@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: tail -f on webpage Message-ID: <20021210185212.GC23550@trot.local> References: <26647.148.243.211.1.1039409754.squirrel@mail.unixmexico.com> <20021209054521.GB20704@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021209054521.GB20704@dan.emsphone.com> User-Agent: Mutt/1.3.28i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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: >> >> > $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-hackers" in the body of the message