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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@spudnut:~/bin$ cat konssh3
#!/bin/sh
# Title: mega-konssh
# Description: create a scriptable konsole with many session tabs
# Author: Stephen Dowdy (sdowdy@xxxxxxxx)
# Caveats:  work-in-progress

host_list="root@host1 root@host2 root@host3 joe@host4 mary@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@xxxxxxxx        -  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.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux