Skip to content

Instantly share code, notes, and snippets.

@rabin-io
Last active December 27, 2021 13:23
Show Gist options
  • Save rabin-io/e7daba62cf273d24730d5e49a8087bc5 to your computer and use it in GitHub Desktop.
Save rabin-io/e7daba62cf273d24730d5e49a8087bc5 to your computer and use it in GitHub Desktop.
ipmitool.sh
#!/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