Configuring Power Management using the command line

This explanation shows 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 a machine's activity are
taken into account.  By default, a machine is considered inactive when
all of these conditions apply:

      No keyboard stroke 

      No mouse movement 

      No TTY characters are input or output 

      No disk reads 

      No NFS requests 

      A 1-minute load average is no greater than 0.04

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 Power Managing Displays , 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)." These are physical devices (such as a mouse) whose
activity is related to another device (such as a frame buffer) without
being 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. 

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

Setting Device Idle Time

You specify the length of idle time before a system device (such as a
screen) uses the low power mode by changing the threshold field in the
/etc/power.conf file. 

To Change the Length of Idle Time

   1.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. Type: 


       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.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. Type:


       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:

ttychars changes the number of TTY characters that can be input or
output before the system is considered active (the default is no
characters)

diskreads changes the number of disk reads that can occur before the
system is considered active (the default is no disk reads)

nfsreqs changes the number of NFS requests that can occur before the
system is considered active (the default is no NFS requests)

loadaverage changes the 1-minute load average that is reached before the
system is considered active (the default is 0.04)

You cannot, however, change the threshold for keyboard or mouse
activity.  Any such activity concludes the period of idleness for a
system. 

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

      No more than 400 TTY characters are input or output

      No more than 10 disk reads occur

      No more than 5 NFS requests occur

      The 1-minute load average hasn't exceeded 0.1

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 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.