-
-
Save bdwarr6/5566892e74c491a6e8fe840ff0217b44 to your computer and use it in GitHub Desktop.
Issues a reset of the SuperMicro BMC via the web interface
This file contains hidden or 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