in reply to Re: Controlling a terminal
in thread Controlling a terminal

You remember right, but this only echo's text to the users terminal rather than run any commands within the terminal for the user.

Essentially I am trying to write a GUI cluster admin tool, whereby text typed into a console is multiplied out to 2 or more terminal windows (and where each window can be typed in individually) to minimise cluster admin headaches.

I have the basic perl outline in my head and the GUI side of it written - i just do not currently know how to control a terminal window in this way.

We have an off-the-shelf tool already but it doesnt support ssh, and it lacks a few "niceties", hence this mini-project.

Replies are listed 'Best First'.
Re^2: Controlling a terminal
by LAI (Hermit) on Jan 21, 2003 at 18:31 UTC

    So you want to run the same command simultaneously on several cluster nodes. Again, I think it would be too much of a headache to open n terminals and tell them all to pass stuff to shells. You would probably be better off using something like Net::SSH and just maintaining one session per node. Maintain an array of references to connections or something like that, and everytime you type a command into your GUI you iterate across the array and pass the command to each connection.


    LAI
    :eof
      After a lot of hunting around on the net I have found out how to do what i want to do; just have to work out whether i not i should be doing it this way in general...
      use warnings; use strict; use constant TIOCSTI => 29719; my $fd; my $c="\n"; open($fd, ">>", "/dev/pts/30") || die "Could not open: $!"; my $val=ioctl($fd, TIOCSTI, $c); print "not ok\n" unless ($val);
      which will send a RETURN into the pseudo terminal (when run as root, anyhow).

      Thanks for your help.

        I'd personally not feel comfortable writing directly to devices like that, but if it does what you need it to then great. I'm enough of a stubborn ass that I still say you ought to let Perl handle the remote connections, but TMTOWTDI.


        LAI
        :eof
      Or even use something like SOAP or XML/RPC to do the server side work. I do this currently over SSL & apache or with the Frontier::RPC2 to collect some system/app stats with great results. I used to do similar things with ssh + keychain, but sometimes i would get some weird hangs on it.

      An intellectual is someone whose mind watches itself.
      - Albert Camus