Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@jworl 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