disconnecting rsh session

S

sc0ri0n

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/\&/&amp;/g;
$_ =~ s/\</&lt;/g;
$_ =~ s/\>/&gt;/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?

Adil
 
J

Jim Gibson

sc0ri0n said:
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/\&/&amp;/g;
$_ =~ s/\</&lt;/g;
$_ =~ s/\>/&gt;/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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top