Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ipmi-consoles() {
- declare -ag IPMI_IP_LIST=($(printf 10.38.14."%s\n" {4..39}))
- byobu new-session -d -s CONSOLES
- SPLITS=6
- WIN=0
- export IPMI_USER=root
- export IPMI_PASSWORD=calvin
- for ((i=0; i<${#IPMI_IP_LIST[@]}; i+=${SPLITS}));do
- PANES=("${IPMI_IP_LIST[@]:i:${SPLITS}}")
- for p in ${!PANES[@]};do
- if [[ ${p} -eq 0 ]];then
- export WIN=$(($WIN+1))
- printf "Creating Window $WIN with $SPLITS consoles\n"
- printf "\e[2G- Connecting to IPMI Console @ ${PANES[$p]}\n"
- byobu new-window -n "${PANES[0]}-${PANES[-1]}" -t CONSOLES bash -lic \
- 'echo;clear
- export IPMI_IP='${PANES[$p]}' IPMI_USER='${IPMI_USER}' IPMI_PASSWORD='${IPMI_PASSWORD}'
- byobu select-layout tiled;echo
- ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate
- reconnect(){ ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate; };export -f reconnect
- clear;echo "Type \"reconnect\" to reestablish the ipmi console session";echo;echo
- bash'
- else
- byobu select-layout tiled
- printf "\e[2G- Connecting to IPMI Console @ ${PANES[$p]}\n"
- byobu splitw -h bash -lic \
- 'echo;clear
- export IPMI_IP='${PANES[$p]}' IPMI_USER='${IPMI_USER}' IPMI_PASSWORD='${IPMI_PASSWORD}'
- byobu select-layout tiled
- ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate
- reconnect(){ ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate; };export -f reconnect
- clear;echo "Type \"reconnect\" to reestablish the ipmi console session";echo;echo
- bash'
- fi
- done
- done
- byobu attach-session -t CONSOLES
- };export -f ipmi-consoles
Add Comment
Please, Sign In to add comment