Using Power Management

Using a Script to Define Idleness

You can create a script that tests additional criteria that must be met before a system is considered inactive long enough to trigger an autoshutdown. After all other idleness criteria have been met, an idlecheck entry in the /etc/power.conf file causes the script you name in that entry to run.

For example, a script located in the /home/grumpy directory will be run on a system that has the following idlecheck line in its /etc/power.conf file whenever the system has been idle according to all other criteria defined in the power.conf file:


# The idlecheck program is passed autoshutdown idle time entry
# in $PM_IDLETIME and returns the number of minutes the system 
# has been idle in exit code
idlecheck          /home/grumpy/idlecheck

Your script should return an exit code representing minutes of idle time. If the exit code is equal or greater than the idle time listed in the "autoshutdown" entry of the /etc/power.conf file, your system will shut down. If the script reports a lower number than the stated idle time, your system will not shut down.


Note -

When you create such a script for idlecheck, make sure it is executable and that it returns an exit code. If the script does not produce an explicit exit code, the value zero is returned, which indicates that the system is busy and autoshutdown does not occur.