#!/usr/bin/perlThe 'smc' executable is contained inside smcFanControl. This script has to be run via sudo, and I've made no provision for watching the temperature and preventing meltdown, but it works well enough for when I just need the fans to STFU for a while so I can watch a video.
# Locks fans at given RPM. Call without arguments to unlock.
$speed = $ARGV[0];
if ($speed) {
# smc wants its input in bitshifted hex for some reason
$hex = sprintf("%x", $speed << 2);
`smc -k "FS! " -w 0007`;
`smc -k F0Tg -w $hex`;
`smc -k F1Tg -w $hex`;
`smc -k F2Tg -w $hex`;
# not locking fan 4, as it seems quieter than the rest
} else {
# unlock fans:
`smc -k "FS! " -w 0000`;
}
print `smc -f`; # show current fan settings
You are not logged in, either login or create an account to post comments
posted by ook at 9:10 AM on August 6, 2012