disconnecting rsh session

Discussion in 'Perl' started by sc0ri0n, Feb 16, 2005.

  1. sc0ri0n

    sc0ri0n Guest

    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
    sc0ri0n, Feb 16, 2005
    #1
    1. Advertising

  2. sc0ri0n

    Jim Gibson Guest

    In article <>, sc0ri0n
    <> 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/\&/&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).


    ----== 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 =---
    Jim Gibson, Feb 16, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Albisser
    Replies:
    2
    Views:
    1,391
    Daniel Albisser
    Feb 24, 2004
  2. Replies:
    1
    Views:
    1,039
    Thomas Weidenfeller
    Apr 8, 2005
  3. David H
    Replies:
    0
    Views:
    479
    David H
    Dec 3, 2004
  4. John

    Disconnecting a SQL Connection from a WebService

    John, Jun 17, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    222
    Ian Jones
    Jun 22, 2004
  5. afrinspray
    Replies:
    6
    Views:
    129
    afrinspray
    Aug 5, 2005
Loading...

Share This Page