Created
May 27, 2015 09:23
-
-
Save n1koo/a1e11be44734431fe8a8 to your computer and use it in GitHub Desktop.
ipmify
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
#!/bin/bash | |
set -x | |
while getopts "a:b:p:s:d" OPTION | |
do | |
case "${OPTION}" | |
in | |
a) ADDR=${OPTARG};; | |
b) BOOTDEV=${OPTARG};; | |
p) POWER=${OPTARG};; | |
s) SERIAL=${OPTARG};; | |
d) DRAC=1;; | |
esac | |
done | |
if [ "$DRAC" -eq 1 ];then | |
USER=redacted | |
PASS=redacted | |
else | |
USER=redacted | |
PASS=redacted | |
fi | |
if [ -n "$BOOTDEV" ];then | |
echo "Setting bootdev to $BOOTDEV" | |
ipmitool -Ilanplus -U $USER -P $PASS -H "$ADDR" chassis bootdev $BOOTDEV | |
fi | |
if [ "$POWER" == "cycle" ]; then | |
echo "Performing power cycle" | |
ipmitool -Ilanplus -U $USER -P $PASS -H "$ADDR" power cycle | |
fi | |
if [ "$SERIAL" == "connect" ]; then | |
clear | |
echo "Activating serial connection" | |
ipmitool -Ilanplus -U $USER -P $PASS -H "$ADDR" sol activate | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment