Created
September 11, 2014 22:24
-
-
Save DavidWittman/98281cdf1d32ac795b74 to your computer and use it in GitHub Desktop.
Issues a reset of the SuperMicro BMC via the web interface
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
#!/usr/bin/env bash | |
# Issues a reset of the SuperMicro BMC via the web interface | |
# | |
# usage: supermicro-bmc-reset.sh <ipmi-host> | |
# e.g.: supermicro-bmc-reset.sh 10.0.0.1 | |
# | |
set -x | |
IPMI_HOST="$1" | |
IPMI_USER=${IPMI_USER:-ADMIN} | |
IPMI_PASS=${IPMI_PASS:-ADMIN} | |
if [[ $# -ne 1 ]]; then | |
echo "usage: $0 <ipmi-host>" | |
exit 1 | |
fi | |
SESSION_ID=$(curl -d "name=${IPMI_USER}&pwd=${IPMI_PASS}" "https://${IPMI_HOST}/cgi/login.cgi" --silent --insecure -i | awk '/Set-Cookie/ && NR != 2 { print $2 }') | |
# It doesn't seem to care about the timestamp, so I don't. | |
curl "https://${IPMI_HOST}/cgi/BMCReset.cgi?time_stamp=Thu%20Sep%2011%202014%2017%3A07%3A02%20GMT-0500%20(CDT)&_=" -H "Cookie: ${SESSION_ID}" --insecure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was extremely helpful for me. I wrote a version of this that is a little more verbose if you'd like to see it: https://gist.github.com/jworl/fd11b2b941627a12b6f6c1e1ad8715dc
Thank you for sharing!