Fork y Señales



Subsecciones
Casiano Rodríguez León
2010-03-22
DER="0" SRC="ggoogle.gif" ALT="google">etsiiullpcgull
Sig: La Depuración de Procesos Sup: Fork y Señales Ant: La Función fork
Casiano Rodríguez León
2010-04-20
indow#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
2011-02-07
E="tex2html8" HREF="http://www.google.es/">googleetsiiullpcgullLHPLHP moodleperlcriticpbpblogsgoogle code project hosting
Sig: Virtual Network Computing Sup: SSH: Secure Shell Ant: Práctica: usando cssh
Casiano Rodríguez León
2011-02-21
dríguez León
2011-02-21 HTML>