diff options
Diffstat (limited to 'ipmi.sh')
-rw-r--r-- | ipmi.sh | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -0,0 +1,45 @@ +#!/bin/sh +# +# | _ +# | o o | | +# | _ _ _ _ , | | +# | | |/ \_/ |/ |/ | | / \_|/ \ +# | |_/|__/ | | |_/|_/o \/ | |_/ +# | /| +# | \| +# +# ipmi.sh +# +# ipmi shared functions +# +# ~ rgoncalves.se + +. ./log.sh + +# load ipmi environment variables +# cross-referenced in next functions, +# and user-scripts. +ipmi_env() { + # export + export IPMI_DEBUG="${IPMI_DEBUG:=false}" + export IPMI_IP="${IPMI_IP:=192.168.5.100}" + export IPMI_USER="${IPMI_USER:=root}" + export IPMI_PASS="${IPMI_PASS:=calvin}" + # debug + if "${IPMI_DEBUG}"; then + for var in $(env | grep "^IPMI_"); do + log "${var}" + done + fi + # cleanup + unset var +} + +# send a raw command to an ipmi host. +# ipmi environment variables are required. +ipmi_cmd() { + out=$(ipmitool -I lanplus -H ${IPMI_IP} -U ${IPMI_USER} -P ${IPMI_PASS} ${@}) + echo "${out}" | awk NF + # cleanup + unset out +} |