Inom
Hitta mer dokumentation
Supportresurser som ingår
| Ladda ner denna bok i PDF
Configuring Power Management Using the Command Line
A
Introduction
- 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 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 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
- To change the idleness definition from these defaults, see Section , "Changing the Idleness Definition," on page 37.
The power.conf File
- The default /etc/power.conf file has the following content:
-
# This is a sample power management configuration file
# Fields must be separated by white space.
# Name Threshold(s) Logical Dependent(s)
/dev/kbd 1800
/dev/mouse 1800
/dev/fb 0 0 /dev/kbd /dev/mouse
# This entry is maintained by dtpower(1M)
# This (default as of Solaris 2.5) entry causes the system to be
# shut down after 30 minutes of idle time if it is a model shipped
# after Oct 1, 1995. Older models default to noshutdown.
#
# autoshutdown in effect
# Auto-Shutdown Idle(min) Start/Finish(hh:mm) Behavior
autoshutdown 30 17:00 8:00 default
|
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.
Becoming Superuser
- To change any of the system default settings, using the procedures in this section, you first must become superuser.
· To become superuser
-
* Become superuser by typing:
-
example% su
Password: root password
example#
|
Setting Device Idle Time
- The length of idle time before a system device (such as a screen) uses the low power mode is specified by the threshold field in the /etc/power.conf file.
· To change the length of idle time
-
-
Edit the /etc/power.conf file. Type:
-
example# vi /etc/power.conf
|
-
-
Modify the desired entry.
- The idle threshold for the keyboard and mouse devices have been revised to be 300 seconds (5 minutes) in the /etc/power.conf file, as shown below.
-
# This is a sample power management configuration file
# Fields must be separated by white space.
# Name Threshold(s) Logical Dependent(s)
/dev/kbd 300
/dev/mouse 300
/dev/fb 0 0 /dev/kbd /dev/mouse
# This entry is maintained by dtpower(1M)
# This (default as of Solaris 2.5) entry causes the system to be
# shut down after 30 minutes of idle time if it is a model shipped
# after Oct 1, 1995. Older models default to noshutdown.
#
# autoshutdown in effect
# Auto-Shutdown Idle(min) Start/Finish(hh:mm) Behavior
autoshutdown 30 17:00 8:00 default
|
-
-
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
-
-
Edit the AutoShutdown entry in /etc/power.conf file. Type:
-
example# vi /etc/power.conf
|
- The AutoShutdown feature has been set to "always" in this portion of an /etc/power.conf file, as shown below (that is, the Start and Finish times are identical). This means your system will always power off 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 in a 24-hour format.
-
# Auto-Shutdown Idle(min) Start/Finish(hh:mm) Behavior
autoshutdown 30 17:30 8:00 shutdown
|
-
-
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 will change the thresholds for certain system operations that can occur before the system is no longer 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 will conclude 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:
-
# This is a sample power management configuration file
# Fields must be separated by white space.
# Name Threshold(s) Logical Dependent(s)
/dev/kbd 1800
/dev/mouse 1800
/dev/fb 0 0 /dev/kbd /dev/mouse
# This entry is maintained by dtpower(1M)
# This (default as of Solaris 2.5) entry causes the system to be
# shut down after 30 minutes of idle time if it is a model shipped
# after Oct 1, 1995. Older models default to noshutdown.
#
# autoshutdown in effect
# Auto-Shutdown Idle(min) Start/Finish(hh:mm) Behavior
autoshutdown 30 17:00 8:00 default
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 will cause the script you name in that entry to be run. For example, a script located in the /home/grumpy directory is 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 /etc/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 be shut down. If the script reports a lower number than the stated idle time, your system will not be 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 will indicate that the system is busy and that autoshutdown will not occur.
|
|