Man PwrStat
From: "https://www.cyberpowersystems.com/product/software/power-panel-personal/powerpanel-for-linux/
PWRSTAT(8) System Administration Tools PWRSTAT(8)
NAME
pwrstat - The UPS power state command tool
SYNOPSIS
pwrstat [-help]|[-version]|[-reset]|
pwrstat [-status]|[-config]|[-alarm on|off]|[-mute]|[-test]|
[-hibernate on|off]|
pwrstat [-pwrfail [-active on|off][-delay sec][-duration sec]
[-cmdname][-shutdown on|off]]
pwrstat [-lowbatt [-active on|off][-runtime sec][-capacity %]
[-duration sec][-cmd name][-shutdown on|off]]
DESCRIPTION
The pwrstat program will help user to get status of the UPS and settings
of the UPS and pwrstatd daemon. It also allow user to configure
UPS and pwrstatd daemon.
OPTIONS
No arguments
Display help content.(Same as "-help")
-status
Display current status of ups.
-config
Display all daemon configurations.
-reset
Reset all daemon configurations to default.
-help
Display help content.
-version
Display the version of program.
-alarm
Setup alarm action of ups.
-mute
Setup temporally mute alarm when alarm is on enable state.
-test
To verify the UPS will work well in battery power.
-hibernate
Setup hibernate to instead of system shutdown when power event occurred.
-pwrfail
Setup the settings of command-execution for power failure.
(This must be the first argument.)
-lowbatt
Setup the settings of command-execution for low battery.
(This must be the first argument.)
-delay*
Setup delay seconds when event occured.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-runtime*
Setup remaining runtime threshold to identify low battery event.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-capacity*
Setup low battery capacity threshold to identify low battery event.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-active*
Setup command-execution or not when event occured.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-cmd*
Assign command file when event occured.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-duration*
Setup duration seconds of command-execution when event occured.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
-shutdown*
Setup shutdown OS or not when event occured.
Note: Arguments with "*" must follow "-pwrfail" or "-lowbatt".
EXAMPLE
Setup action for power failure as example
pwrstat -pwrfail -delay 60 -active on -cmd
/etc/pwrstatd-powerfail.sh -duration 1 -shutdown on
As above setting, it will take 1 second to run a shell script
/etc/pwrstatd-powerfail.sh and
shutdown system since utility power has failure for 1 minute.
Setup action for low battery as example
pwrstat -lowbatt -runtime 300 -capacity 35 -active on -cmd
/etc/pwrstatd-lowbatt.sh -duration 1 -shutdown on
As above setting, it will take 1 second to run a shell script
/etc/pwrstatd-lowbatt.sh and
shutdown system since UPS's remaining runtime has low than 300 seconds
or battery capacity has low than 35 %.
Note.
- The battery capacity Threshold can be chnaged in file
/etc/pwrstatd.conf.
- The parameter -pwrfail and -lowbatt are exclusively.
- The unit of options -delay is second.
- Both shell script /etc/pwrstatd-powerfail.sh and
/etc/pwrstatd-lowbatt.sh were copied in installation procedure.
- The parameter -pwrfail least one of parameter -delay, -active,
-cmd, -duration or -shutdown is necessary.
- The parameter -lowbatt least one of parameter -runtime, -capacity,
-active, -cmd, -duration or -shutdown is necessary.
- The options of -cmd can be any shell script in system, but it
will be run by root authority.
- The default action setting for both of -pwrfail and -lowbatt are
same as above setting of example.
Setup UPS alarm
pwrstat -alarm on
pwrstat -alarm off
To turn UPS's alarm On or Off.
Setup UPS mute temporary
pwrstat -mute
To mute UPS's alarm for this power event until next one.
Setup UPS to do a battery test
pwrstat -test
To verify the UPS will work well in battery power.
Setup hibernation
pwrstat -hibernate
Using hibernate to instead of system shutdown when power event occurred.
SEE ALSO
pwrstatd( 8 )
COPYRIGHT
Copyright(c) 2015. All rights reserved.
pwrstat 1.4.1 November 2021 PWRSTAT(8)