Guest User

Untitled

a guest
Jan 19th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. ipmi-consoles() {
  2. declare -ag IPMI_IP_LIST=($(printf 10.38.14."%s\n" {4..39}))
  3. byobu new-session -d -s CONSOLES
  4. SPLITS=6
  5. WIN=0
  6. export IPMI_USER=root
  7. export IPMI_PASSWORD=calvin
  8. for ((i=0; i<${#IPMI_IP_LIST[@]}; i+=${SPLITS}));do
  9. PANES=("${IPMI_IP_LIST[@]:i:${SPLITS}}")
  10. for p in ${!PANES[@]};do
  11. if [[ ${p} -eq 0 ]];then
  12. export WIN=$(($WIN+1))
  13. printf "Creating Window $WIN with $SPLITS consoles\n"
  14. printf "\e[2G- Connecting to IPMI Console @ ${PANES[$p]}\n"
  15. byobu new-window -n "${PANES[0]}-${PANES[-1]}" -t CONSOLES bash -lic \
  16. 'echo;clear
  17. export IPMI_IP='${PANES[$p]}' IPMI_USER='${IPMI_USER}' IPMI_PASSWORD='${IPMI_PASSWORD}'
  18. byobu select-layout tiled;echo
  19. ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate
  20. reconnect(){ ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate; };export -f reconnect
  21. clear;echo "Type \"reconnect\" to reestablish the ipmi console session";echo;echo
  22. bash'
  23. else
  24. byobu select-layout tiled
  25. printf "\e[2G- Connecting to IPMI Console @ ${PANES[$p]}\n"
  26. byobu splitw -h bash -lic \
  27. 'echo;clear
  28. export IPMI_IP='${PANES[$p]}' IPMI_USER='${IPMI_USER}' IPMI_PASSWORD='${IPMI_PASSWORD}'
  29. byobu select-layout tiled
  30. ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate
  31. reconnect(){ ipmitool -H ${IPMI_IP} -I lanplus -U ${IPMI_USER} -E sol activate; };export -f reconnect
  32. clear;echo "Type \"reconnect\" to reestablish the ipmi console session";echo;echo
  33. bash'
  34. fi
  35. done
  36. done
  37. byobu attach-session -t CONSOLES
  38. };export -f ipmi-consoles
Add Comment
Please, Sign In to add comment