Skip to content

Instantly share code, notes, and snippets.

@n1koo
Created May 27, 2015 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n1koo/a1e11be44734431fe8a8 to your computer and use it in GitHub Desktop.
Save n1koo/a1e11be44734431fe8a8 to your computer and use it in GitHub Desktop.
ipmify
#!/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