Some sample code and tips can be found here about Power Management on Linux/Fedora: