summaryrefslogtreecommitdiffstats
path: root/ipmi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ipmi.sh')
-rw-r--r--ipmi.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/ipmi.sh b/ipmi.sh
new file mode 100644
index 0000000..e029784
--- /dev/null
+++ b/ipmi.sh
@@ -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
+}
remember that computers suck.