summaryrefslogtreecommitdiffstats
path: root/ipmi-fan
diff options
context:
space:
mode:
authorbinary <commit@rgoncalves.se>2021-02-19 17:20:18 +0100
committerbinary <commit@rgoncalves.se>2021-02-19 17:20:18 +0100
commitd2c6a6a0edd7a07b2b2a4c497cb03f8f17b74f23 (patch)
tree3a5a042e6c906e12c5f78d359bfac516124cb6a3 /ipmi-fan
downloadscripts-d2c6a6a0edd7a07b2b2a4c497cb03f8f17b74f23.tar.gz
restart from scratch
Diffstat (limited to 'ipmi-fan')
-rwxr-xr-xipmi-fan64
1 files changed, 64 insertions, 0 deletions
diff --git a/ipmi-fan b/ipmi-fan
new file mode 100755
index 0000000..8fb5dbc
--- /dev/null
+++ b/ipmi-fan
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# | _
+# | o o | |
+# | _ _ _ _ | | __, _ _
+# | | |/ \_/ |/ |/ | |-----|/ / | / |/ |
+# | |_/|__/ | | |_/|_/ |__/\_/|_/ | |_/
+# | /| |\
+# | \| |/
+#
+# ipmi-fan
+#
+# controls fan speed for servers and computers using ipmi
+# only supports dell idrac 6 for now (r710 battletested)
+#
+# ~ rgoncalves.se
+
+. ./ipmi.sh
+. ./log.sh
+
+usage() {
+ cat <<-EOF
+ usage: ${0} -s speed
+ EOF
+}
+
+log() {
+ echo "[${0} ] $@"
+}
+
+main() {
+ # parse
+ while getopts "s:" arg; do
+ case "${arg}" in
+ s)
+ speed="${OPTARG}"
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+ done
+
+ # Check fan speed validity
+ if [ -z ${speed} ]; then
+ log "-s must be a valid fan speend"
+ usage
+ exit 1
+ fi
+
+ # load environment variables for IPMI
+ ipmi_env
+
+ # disable automatic fan control
+ ipmi_cmd raw 0x30 0x30 0x01 0x00
+ log "automatic fan control disabled"
+
+ # change fan speed
+ ipmi_cmd raw 0x30 0x30 0x02 0xff "0x${speed}"
+ log "set fan control to ${speed}"
+}
+
+main $@
remember that computers suck.