Práctica: usando cssh

Casiano Rodríguez León
2010-03-22
E="tex2html285" HREF="http://tentakel.biskalar.de/similar/">tentakel
  • gsh
  • En Python: pssh
  • ClusterIt
  • Project C3


  • Subsecciones
    Casiano Rodríguez León
    2010-04-19
    nt newY) void setGeometry(int newX,int newY,int newWidth,int newHeight) void raise() void lower() void restore() void show() void close()

    Vamos a minimizarla:

    lusasoft@LusaSoft:~/src/perl/perltesting/dcop$ dcop konsole-10832 konsole-mainwindow#1 minimize
    

    Cambiando el Color de Fondo

    Otro ejemplo. Cambiemos el color de fondo:

    casiano@europa:~$ dcop kdesktop KBackgroundIface  setWallpaper /tmp/393_5052_2.jpg
    casiano@europa:~$ dcop kdesktop KBackgroundIface setColor '#E444F2' true
    casiano@europa:~$ dcop kdesktop KBackgroundIface setColor '#68F20B' true
    

    Ejemplo: knotes

    He aqui un ejemplo que ilustra como establecer notas post-it con knotes desde la shell:

    $dcop knotes KNotesIface
    QCStringList interfaces()
    QCStringList functions()
    int newNote(QString name,QString text)
    int newNoteFromClipboard(QString name)
    ASYNC showNote(int noteId)
    ASYNC hideNote(int noteId)
    ASYNC killNote(int noteId)
    QMap notes()
    ASYNC setName(int noteId,QString newName)
    ASYNC setText(int noteId,QString newText)
    QString text(int noteId)
    ASYNC sync(QString app)
    bool isNew(QString app,int noteId)
    bool isModified(QString app,int noteId)
    

    Vamos a añadir una nota:

    dcop knotes KNotesIface newNote "Titulo de la Nota" "Corregir exámenes"
    

    Ahora veamos las notas que tenemos disponibles:

    lusasoft@LusaSoft:~/src/perl/perltesting/dcop$ dcop knotes KNotesIface notes
    libkcal-2096876672.442->Titulo de la Nota
    libkcal-461202155.843->03-05-09 15:06
    libkcal-962646955.232->Una nota
    

    Conexiones SSH con konsole

    lusasoft@LusaSoft:~/src/perl/perltesting/dcop$ cat -n dcop_control.pl
     1  #!/usr/bin/perl -w
     2  use strict;
     3  use Log::Log4perl qw(:easy);
     4  use Time::HiRes qw(usleep);
     5  use Backtick::AutoChomp;
     6
     7  Log::Log4perl->easy_init($DEBUG);
     8  my $logger = Log::Log4perl->get_logger();
     9
    10  my @servers = qw{orion beowulf europa};
    11
    12  my $konsole= `dcopstart konsole-script`;
    13
    14  $logger->warn("can't maximize window\n") if system("dcop $konsole konsole-mainwindow#1 maximize");
    15
    16  my $thissession= qx{dcop $konsole konsole currentSession};
    17
    18  # rename this window/session
    19  system qq{dcop $konsole $thissession renameSession "init"};
    20
    21  # start a new session tab for each server
    22  for  (@servers) {
    23    # this output is displayed on the terminal which is running your script
    24    $logger->debug("connecting to server: $_");
    25
    26    # create another konsole tab and save handle in $newsession
    27    my $newsession=`dcop $konsole konsole newSession "ssh $_"`;
    28
    29    # wait for shell startup - raise if needed
    30    usleep(1000) while `dcop $konsole $newsession sessionPID` eq 0;
    31
    32    # rename the new session
    33    !system(qq{dcop $konsole $newsession renameSession $_}) or $logger->warn("can't rename new session to $_\n");
    34
    35    # and start the ssh session
    36    !system(qq{dcop $konsole $newsession sendSession "exec ssh $_ @ARGV"}) or $logger->warn("can't exec ssh  $_ @ARGV\n");
    37
    38  }
    39
    40  # close the first session window
    41  !system(qq{dcop $konsole $thissession closeSession > /dev/null}) or $logger->warn("can't close intial session\n");
    42
    43  __END__
    

    Véase También



    Subsecciones
    Casiano Rodríguez León
    2010-05-05