epcim
8/8/2016 - 2:18 PM

byobu with default windows

byobu with default windows

#!/bin/bash
test -n SSH_AGENT || {
  eval $(ssh-agent -s)
  ssh-add
}

#create session
byobu-tmux new-session -dn $(hostname -f) "sudo -i"

# populate from salt-key
HOSTS=($(sudo salt-key -l acc  |grep -v 'Accepted'))
for H in ${HOSTS[@]}; do
  [[ "ctl dbs ntw kvm prx" =~ ${H/[0-9]*} ]] || continue
  byobu-tmux new-window -n ${H/.*/} "ssh -t $USER@$H 'sudo -i'"
done;

# attach
byobu-tmux attach
exit 0

# or by hand
byobu-tmux new-window -n ctl01 'ssh -t $USER@ctl01 "sudo -i"'
byobu-tmux new-window -n ctl02 'ssh -t $USER@ctl02 "sudo -i"'
byobu-tmux new-window -n ctl03 'ssh -t $USER@ctl03 "sudo -i"'
byobu-tmux new-window -n dbs01 'ssh -t $USER@dbs01 "sudo -i"'
byobu-tmux new-window -n dbs02 'ssh -t $USER@dbs02 "sudo -i"'
byobu-tmux new-window -n dbs03 'ssh -t $USER@dbs03 "sudo -i"'
byobu-tmux new-window -n ntw01 'ssh -t $USER@ntw01 "sudo -i"'
byobu-tmux new-window -n ntw02 'ssh -t $USER@ntw02 "sudo -i"'
byobu-tmux new-window -n ntw03 'ssh -t $USER@ntw03 "sudo -i"'
byobu-tmux new-window -n mon01 'ssh -t $USER@mon01 "sudo -i"'
byobu-tmux new-window -n prx01 'ssh -t $USER@prx01 "sudo -i"'
#byobu-tmux new-window -n log01 'ssh -t $USER@log01 "sudo -i"'
#byobu-tmux new-window -n mdb01 'ssh -t $USER@mdb01 "sudo -i"'
#byobu-tmux new-window -n mtr01 'ssh -t $USER@mtr01 "sudo -i"'
#byobu-tmux new-window -n bil01 'ssh -t $USER@bil01 "sudo -i"'
#byobu-tmux new-window -n nal01 'ssh -t $USER@nal01 "sudo -i"'
#byobu-tmux new-window -n nal02 'ssh -t $USER@nal02 "sudo -i"'
#byobu-tmux new-window -n nal03 'ssh -t $USER@nal03 "sudo -i"'
byobu-tmux attach