In article <wJ********************@comcast.com>, sc0ri0n
<sc*****@hotmail.com> wrote:
Hi,
I want to be able to tail -f log files on a different machine and display
the results in a web page. Below code from the cgi works:
$cmd = "rsh -l $acc $Host tail -f $LogFileName |";
$count=0;
open LOG, $cmd or die "Could not open file: $!";
while (<LOG>){
$_ =~ s/\&/&/g;
$_ =~ s/\</</g;
$_ =~ s/\>/>/g;
print "$_";
last if (count++ >100);
}
exit;
However; problem is that I can not end the session! If for example a user
clicks stop; or closes the window, on the target machine, I still see
'tail -f $LogFileName' under $acc user...
It looks like the above cgi does not stop neither the rsh connection.
Did anyone do something like this? How is it possible to close the
connection?
You are trying to abuse the HTTP protocol, which normally is a
request-response action and not a long-term connection.
You could try using a client-pull and periodically refresh the page
with the current contents of the log file. See some HTTP tutorial or
reference on how to do that. See also this article on how to do this in
Perl: <http://www.stonehenge.com/merlyn/LinuxMag/col39.html>.
FYI: this newsgroup is defunct. Try comp.lang.perl.misc in the future
(but keep in mind that your question is more about HTTP and rsh than
Perl).
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---