I was thinking of this on the way home - I need an array.
the number of $i is going to corelate to a tmux window and a separate host - so when
I attach to the session, each windows is going to be ssh'd to a separate host 9one
of the hosts in the array)
i will try thi sout tomorrow when I get to work.
Code:
#!/bin/bash
sn=test_windows_session_4
tmux new-session -s "$sn" -d
for i in {1..10}; do
tmux new-window -t "$sn:$i"
done
declare -a hosts=('casperutil' 'casperpats' 'casperpats' 'casperblob' 'casperblob' 'caspercore'
'caspercore' 'casperrash' 'casperrash')
for i in {1..10} ; do
tmux send-keys -t "$sn:$i" "ssh -l casper ${hosts[$i]}"
sleep 5
done
if you don't use tmux - it is like linux screen, but scriptable