This commit is contained in:
wvr
2023-05-14 16:00:27 -05:00
commit b8549f1c9b
15 changed files with 305 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
#!/bin/sh -e
#
# script to manage fan speeds on dell poweredge servers
# note: uses default creds of root/calvin
#
# * NOTE: *
# To resolve ipmi issue, need to change the IPMI over LAN setting from
# [Disabled] to [Enabled] in the iDRAC/iLO.
#
# default creds are root/calvin
: "${IDRAC_USER:=root}"
: "${IDRAC_PW:=calvin}"
usage() {
>&2 printf 'Usage: %s host [-a]|[1-100]\n' "${0##*/}"
exit 1
}
dec2hex() {
printf '%x\n' "$1"
}
sendcommand() {
# shellcheck disable=2086
ipmitool \
-I lanplus \
-H "${IDRAC_IP:-192.168.0.94}" \
-U "$IDRAC_USER" \
-P "$IDRAC_PW" \
$1
}
manual='raw 0x30 0x30 0x01 0x00'
auto='raw 0x30 0x30 0x01 0x01'
case $1 in
-h|--help)
usage
esac
case ${1#-} in
m|manual)
sendcommand "$manual"
;;
a|automatic)
sendcommand "$auto"
;;
*)
sendcommand "$manual" &&
case $1 in
[1-9])
sendcommand "raw 0x30 0x30 0x02 0xff 0x0$1"
;;
*)
sendcommand "raw 0x30 0x30 0x02 0xff 0x0$(dec2hex "$1")"
esac
esac