Skip to content

Instantly share code, notes, and snippets.

@epcim epcim/byobu.sh
Last active Aug 12, 2016

Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.