Using Power Management

Appendix A Configuring Power Management Using the Command Line

This chapter explains how you can change the system default settings for the Power Management utilities on systems that are not configured to run the CDE or OpenWindows environment. Also, you can edit the /etc/power.conf file to change the definition of idleness for a system in ways that cannot be set through the dtpower user interface.


Note -

Refer to the power.conf(4)man page for additional information.


Idleness Definition

In earlier releases of Power Management software, inactivity of a system was defined only in terms of the amount of time since the last keyboard or mouse activity. Now, additional aspects of machine activity are taken into account. By default, a machine is considered inactive when all of these conditions apply:

To change the idleness definition from these defaults, see "Changing the Idleness Definition".


Note -

Running a screen saver pattern in CDE, other than the blank screen option, may create additional system activity that prevents the system from being idle enough to qualify for AutoShutdown. To enable a system that runs a screen pattern to AutoShutdown at a specified idle time, you may need to change the threshold settings for load average or disk reads.


The power.conf File

The power.conf file in the /etc directory lets you set the configuration for managing system power. It also enables you to set display power configurations that are followed for that display when a CDE or OpenWindows desktop isn't present. (See Chapter 2, Managing Monitor Power for details on managing display power in those windowing environments.)

The default /etc/power.conf file has the following content:


# Power Management Configuration File
#
# Putting an entry in this file will only be effective if the 
# driver for the device supports device power management. 
# After the file is modified, pmconfig(1M) command must be
# executed to activate the new change.
#
# Fields must be separated by white space or semicolons.
# Note that physical dependents are automatically considered
# by the power management framework.

# Name           Threshold(s)       Logical Dependent(s)
/dev/kbd         1800
/dev/mouse       1800

# NOTE: The entries below are only used when no window
# system is running. When running the window system, monitor
# power management is done by the screen saver functions.

/dev/fb          0 0               /dev/kbd     /dev/mouse

# Auto-Shutdown  Idle(min)  Start/finish(hh:mm)  Behavior
autoshutdown     30          9:00 9:00           default

statefile        /.CPR

Logical Dependents

In the /etc/power.conf file, there are entries for Logical Dependent(s). Each is a physical device (such as a mouse) that has activity that is related to another device (such as a frame buffer) but is not physically attached to it.

If a logical dependent device is active, then the main device is considered active as well. This affects idle times for the main device.

Becoming Superuser

To change any of the system default settings by using the procedures in this section, you first must become superuser.

To Become Superuser
  1. Type:


    example% su
    Password: root password
    example#

Setting Device Idle Time

You can specify the length of idle time before a system device (such as a screen) starts using uses its low power mode. To do this, change the threshold field in the /etc/power.conf file.

To Change the Length of Idle Time
  1. As superuser, edit the /etc/power.conf file. Type:

    example# vi /etc/power.conf

  2. Modify the desired entry.

    The idle threshold for the keyboard and mouse devices has been revised to be 300 seconds (5 minutes) in the /etc/power.conf file, as shown below.


    # Power Management Configuration File
    #
    # Putting an entry in this file will only be effective if the 
    # driver for the device supports device power management. 
    # After the file is modified, pmconfig(1M) command must be
    # executed to activate the new change.
    #
    # Fields must be separated by white space or semicolons.
    # Note that physical dependents are automatically considered
    # by the power management framework.
    
    # Name           Threshold(s)       Logical Dependent(s)
    /dev/kbd         300
    /dev/mouse       300
    
    # NOTE: The entries below are only used when no window
    # system is running. When running the window system, monitor
    # power management is done by the screen saver functions.
    
    /dev/fb          0 0         /dev/kbd     /dev/mouse
    
    # Auto-Shutdown  Idle(min)  Start/finish(hh:mm)  Behavior
    autoshutdown     30          9:00 9:00           default
    
    statefile        /.CPR

  3. Inform the Power Management framework of the new settings by typing:

    example# /usr/sbin/pmconfig

    Running pmconfig informs the Power Management framework of the new setting according to the thresholds that are now defined in the /etc/power.conf file.

Setting AutoShutdown

To Change the Automatic Shutdown Time
  1. As superuser, edit the AutoShutdown entry in /etc/power.conf file. Type:

    example# vi /etc/power.conf

    The AutoShutdown feature is set to be ready to activate "always" in the portion of an /etc/power.conf file shown below, by entering identical Start and Finish time values. This means your system will power off at any time of day after a 30-minute period of inactivity.


    # Auto-Shutdown    Idle(min)    Start/Finish(hh:mm)    Behavior
    autoshutdown       30           0:00 0:00              shutdown

    The AutoShutdown time in the portion of the /etc/power.conf file shown below is set to power off your system every day between 5:30 pm and 8:00 am after a 30-minute period of inactivity.


    Note -

    The start and finish times must be entered into the power.conf file in a 24-hour format.


    # Auto-Shutdown    Idle(min)    Start/Finish(hh:mm)    Behavior
    autoshutdown       30           17:30 8:00             shutdown


  2. Inform the Power Management framework of the new settings by typing:

    example# /usr/sbin/pmconfig

    Running pmconfig informs the Power Management framework of the new setting according to the thresholds that are now defined in the /etc/power.conf file.

Changing the Idleness Definition

You can change the idleness definition for a system from the default by adding entries to the /etc/power.conf file. These entries change the thresholds for certain system operations that could occur on a system that was still considered inactive:

You cannot, however, change the threshold for keyboard or mouse activity. Any activity with these devices ends the period of idleness for a system.

For example, you can revise your power.conf file to change the idleness definition for a system so that it is still considered idle if:

The resulting /etc/power.conf file appears like the following:


# Power Management Configuration File
#
# Putting an entry in this file will only be effective if the 
# driver for the device supports device power management. 
# After the file is modified, pmconfig(1M) command must be
# executed to activate the new change.
#
# Fields must be separated by white space or semicolons.
# Note that physical dependents are automatically considered
# by the power management framework.

# Name           Threshold(s)       Logical Dependent(s)
/dev/kbd         1800
/dev/mouse       1800

# NOTE: The entries below are only used when no window
# system is running. When running the window system, monitor
# power management is done by the screen saver functions.

/dev/fb          0 0         /dev/kbd     /dev/mouse

# Auto-Shutdown  Idle(min)  Start/finish(hh:mm)  Behavior
autoshutdown     30          15:00 8:00           default

statefile        /.CPR

ttychars            400
diskreads           10
nfsreqs             5
loadaverage         0.1

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.


Changing the Statefile Location

When the system is suspended, a statefile is created by the Suspend-Resume software that preserves checkpoint information about that system at the time it was shut down. You can specify any UFS location for this statefile by editing the /etc/power.conf file to include an entry in this format:

statefile location

For location, provide the absolute path name of a local UFS file.

The size of the file created at this location depends on a variety of factors, including the size of the system's memory, the number of loadable drivers or modules in use, the number and type of processes running, and the amount of user memory that has been "locked down."

Power Management for Two Monitors on One System

If your workstation has two monitors (sometimes called a "double-headed system"), Power Management control of both displays is supported through the CDE and OpenWindows windowing environments. The /etc/power.conf file no longer needs to be edited to provide support for the second monitor.