Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an unusual server set-up. Basically, I have a combination of salvaged parts from 3 Powerbook G4s running a non-graphical distribution of lubuntu. Problem is, I'm better with hardware than the software side of things.

I'm powering a USB fan (as all other connectors are gone) that I want to turn on when the CPU reaches a certain temperature. Eventually I'll install a proper temperature sensor, but for now that will have to do.

I'm sure there's a simple script I could write for this which could run in the background monitoring the temperature and enabling power to the USB port. Any ideas? Suggestions?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

i think you could turn on/off your fan by running the following command:

# turn off
echo suspend > /sys/bus/usb/devices/usbX/power/level

# turn on
echo on > /sys/bus/usb/devices/usbX/power/level

replace usbX with usb1, usb2 or whatever

then you would have to check the temperatur periodically, for example by running a script every minute using cron job. You can take a look at this german article to see how to implement it. Don't worry if you do not speak german. The bash script from the example is pretty easy to understand without the surrounding text.

share|improve this answer
    
This is perfect, thanks heaps for your help. You're a life saver. Your example worked off the bat. Thank you :) –  user1652011 Nov 26 '12 at 9:28
1  
you are welcome. –  Yevgeniy M. Nov 26 '12 at 11:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.