Last active
December 27, 2021 13:23
-
-
Save rabin-io/e7daba62cf273d24730d5e49a8087bc5 to your computer and use it in GitHub Desktop.
ipmitool.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://gist.github.com/rabin-io/e7daba62cf273d24730d5e49a8087bc5 | |
_HOSTS=/etc/dci-openshift-agent/hosts | |
_HOST=${1?Missing Hostname} | |
ipmi_user=root | |
_IPMI_VARS=$(grep -i $_HOST $_HOSTS | sed 's/ /\n/g' | grep 'ipmi') | |
if [[ -z ${_IPMI_VARS} ]] ; | |
then | |
echo "Can not extract vars from host file" | |
exit 1 | |
fi | |
eval $_IPMI_VARS | |
shift | |
echo -n "${_HOST} > " | |
ipmitool -I lanplus -H ${ipmi_address} -U ${ipmi_user} -P ${ipmi_password} $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment