I have an early 2009 iMac with a sensor problem. The ODD and CPU fans run at full speed. To get them down to minimum speed in Ubuntu I need to set the speeds in the Terminal, using this method. Rather than do this after every boot, I made a bash script to do it for me, but it doesn't work.
This is my script:
#!/bin/bash
echo "Beginning script..."
echo "Logging in as root..."
sudo su
cd /sys/devices/platform/applesmc.768/
echo "Enabling manual override for Fan 1 (ODD fan)..."
echo '1' > fan1_manual
echo "Setting speed of Fan 1 (ODD fan) to 1650 RPM..."
echo '1650' > fan1_output
echo "Enabling manual override for Fan 3 (CPU fan)..."
echo '1' > fan3_manual
echo "Setting speed of Fan 3 (CPU fan) to 1200 RPM..."
echo '1200' > fan3_output
echo "Done."
The problem is at "sudo su". It prompts for a password, but after entering the password, nothing happens. It just halts.