Skip to content

Instantly share code, notes, and snippets.

@DavidWittman
Created September 11, 2014 22:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save DavidWittman/98281cdf1d32ac795b74 to your computer and use it in GitHub Desktop.
Save DavidWittman/98281cdf1d32ac795b74 to your computer and use it in GitHub Desktop.
Issues a reset of the SuperMicro BMC via the web interface
#!/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
@jworl
Copy link

jworl commented Jun 27, 2017

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment