#!/bin/bash # # Helper to make a web page with links to hosts and their consoles # (ILOs). Pass the name of the cluster as an optional parameter to # customise the page title. # # At present this is mainly to make it easier to navigate to the ILO # console of a machine based on its hostname instead of cutting and # pasting. The host link is not currently useful. This will be # expanded to emit more useful host links at some point. # # This script expects a file cluster.txt to exist and have the format: # HOSTNAME MACADDRESS IPADDR ILOIPADDR DOMAIN ROLE # # Usage : ./cluster-to-html.sh MYCLUSTER > mycluster.html # # if [[ ! -z "$1" ]] { setglobal CLUSTERNAME = $1 } if [[ ! -f "cluster.txt" ]] { "Error: cluster.txt not found" exit } echo -e "" echo -e "\nCluster $CLUSTERNAME members" echo -e "" echo -e "\n

Cluster $CLUSTERNAME members

\n
" echo -e "" while read HOSTNAME MACADDR IPADDR ILOIPADDR DOMAIN ROLE { if [[ "$ROLE" = "head" ]] { setglobal COLOR = 'red' } elif [[ "$ROLE" = "bootstrap" ]] { setglobal COLOR = 'purple' } else { setglobal COLOR = 'black' } echo -e "" echo -e "" echo -e "" echo -e "" echo -e "" echo -e "" } < cluster.txt echo -e "
$HOSTNAMEhostilo" echo -e "" echo -e $ROLE echo -e "" echo -e "
" echo -e "" echo -e ""