blob: 8fb5dbcf61d2b3c77b6738966975443edf4e3c61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 $@
|