Simple DCOP Shell Script for Konsole to Open Multiple Sessions

After having a few dozens servers, just opening remote shell to each servers is becoming tedious. This is a simple shell script I wrote to open multiple session on the running Konsole. Put the sessions you want to open in $SESSION variable, and make sure you have the sessions already created in Konsole:

#!/bin/sh
 SESSIONS="root@server1 root@server2 root@server3"
 HEIGHT=575
 WIDTH=890
 KONSOLE=`dcopclient $KONSOLE_DCOP`
 CURSESSION=$KONSOLE_DCOP_SESSION
 dcop $KONSOLE 'konsole-mainwindow#1' resize $WIDTH $HEIGHT
 for A in $SESSIONS ; do
     NEWSESSION=`dcop $KONSOLE konsole newSession $A`
     SIMPLE=`echo $A | sed 's/..*//g'`
     dcop $KONSOLE $NEWSESSION renameSession $SIMPLE
 done
 dcop $CURSESSION closeSession

8 comments

Leave a Reply to Priyadi Cancel reply

Your email address will not be published. Required fields are marked *