ssh to multiple servers in seperate tabs in Konsole with one?bookmark or script?

Stephen Dowdy sdowdy at ucar.edu
Thu Aug 7 02:14:07 BST 2008


JW wrote, On 08/06/2008 05:47 PM:

JW,

fwiw, here's a framework (no error checking, buggy) based upon the
scripts i sent out earlier for a scripted "Mega Konsole" that i think
does what you want.  There are security implications of the "--script"
option to 'konsole' (i don't know what they all are and the extent of
access control to the session).  Also, this doesn't do cool things like
clusterssh where you can actually do non-blocked editing of files, etc,
but from your description of using "Send Input to all Sessions", i
don't think you need that.  (i *think* your issue about having to
send-all a password to 'su'/'sudo' should work if you do it right
and don't use the while-loop list of commands to exec.)

--stephen

sdowdy at spudnut:~/bin$ cat konssh3
#!/bin/sh
# Title: mega-konssh
# Description: create a scriptable konsole with many session tabs
# Author: Stephen Dowdy (sdowdy at ucar.edu)
# Caveats:  work-in-progress

host_list="root at host1 root at host2 root at host3 joe at host4 mary at host5"

# Create the MainWindow....
konsole \
    --script \
    --caption "Bungload of Sessions" \
    --T "Bungload of Sessions" \
    --nomenubar \
    --vt_sz 132x42 \
    --noclose \
    &
KID="konsole-$!"

for session in ${host_list}; do
  sid=$(dcop ${KID} konsole newSession)
  dcop ${KID} ${sid} renameSession "${session}" 
  dcop ${KID} ${sid} sendSession "ssh $session"
done

# close the now useless first session
dcop ${KID} session-1 closeSession

dcop ${KID} konsole sendAllSessions "echo 'Hello World'"

# Run our list of commands across all session tabs
while read command; do
  dcop ${KID} konsole sendAllSessions ${command}
<<"EOF"
cp /etc/passwd /etc/passwd.safe
sed -i -e 'g/^bob:/d' /etc/passwd
echo "that wasn't very smart"
EOF

echo "You can now do things like:"
echo 'dcop ${KID} konsole sendAllSessions "shutdown -h now"'

exit 0


-- 
Stephen Dowdy  -  Systems Administrator  -  NCAR/RAL
303.497.2869   -  sdowdy at ucar.edu        -  http://www.ral.ucar.edu/~sdowdy/

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list