#!/bin/bash
#
# ======================================================================
# VI editor settings
# set shiftwidth=4
# set tabstop=4
# ======================================================================
# Title: Forces ALL nodes to power on
# Author: Mike Gore
# Date: 7 July 2015
# Depends: package: openipmi, BASH scripts:  common_host,common_vars,common_functions and /usr/local/bin/NODES
#
# Example: ./pxepoweron 
#           - needs and AMDIN user and password to function
# Result: ALL nodes will power on NOW
#
# Notes:
#        The script will prompt for ADMIN user and password unless the following environment variables are set:
# ADMIN - userid of ADMIN user
# ADMINPASS - Password of "ADMIN" user
# ======================================================================


. common_vars
. NODES

setadmin 


for i in $ILOM_NODES
do 
	LOM="$i"
	if ping -c 1 -w 1 "$LOM" 2>/dev/null >/dev/null
	then
		echo "Node $LOM is up"
		host $LOM
		./pxepoweron $i
	else
		echo "Node $LOM is down"
	fi
done