使用apctest命令修改APCUPS电池更换时间
APCUPS的电池更换时间存在UPS的EEPROM(Electrically Erasable Programmable read only memory,带电可擦可编程只读存储器)中。在使用apcupsd进行电池管理时,我们可以使用apcupsd自带的apctest命令完成对电池更换时间的修改。
修改步骤
以下步骤测试于APCUPS 650,使用usb模式连接
- 关闭apcupsd;
- 运行apctest命令;
- 按照提示选择修改电池更换日期选项,回车;
- 按照提示格式输入电池更换日期,回车;
- ‘q’键退出apctest命令;
- 重启apcupsd服务。
CentOS6操作步骤
#第一步:关闭apcupsd服务
[root@asdfsdfsad ~]# /etc/init.d/apcupsd stop
Shutting down UPS monitoring: [确定]
#第二步:运行apctest命令
[root@asdfsdfsad ~]# apctest
#以下是显示的一些电池运行信息
2019-06-12 23:30:09 apctest 3.14.10 (13 September 2011) redhat
Checking configuration ...
Attached to driver: usb
sharenet.type = ShareUPS
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...
You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.
Getting UPS capabilities...SUCCESS
Please select the function you want to perform.
1) Test kill UPS power
2) Perform self-test
3) Read last self-test result
4) View/Change battery date
5) View manufacturing date
6) View/Change alarm behavior
7) View/Change sensitivity
8) View/Change low transfer voltage
9) View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
Q) Quit
#第三步:按照提示,输入4,回车
Select function number: 4
Current battery date: 12/14/2016
Enter new battery date (MM/DD/YYYY), blank to quit:
#第四步:按照格式,输入电池更换日期。这里例子中并没有更换,直接回车了
Invalid format.
#第五步:上一步结束后会自动回到该菜单,输入q并回车退出
1) Test kill UPS power
2) Perform self-test
3) Read last self-test result
4) View/Change battery date
5) View manufacturing date
6) View/Change alarm behavior
7) View/Change sensitivity
8) View/Change low transfer voltage
9) View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
Q) Quit
Select function number: q
2019-06-12 23:30:35 End apctest.
#最后记得重启apcupsd服务
[root@git ~]# /etc/init.d/apcupsd start
Starting UPS monitoring: [确定]
Windows操作步骤
-
关闭apcupsd;
-
运行apctest命令,windows中该命令在apcupsd安装目录下的bin文件夹中;
-
按照提示选择修改电池更换日期选项,回车;
-
按照提示格式输入电池更换日期,回车;
-
‘q’键退出apcaccess命令;
-
重启apcupsd服务,可以看到日期已经更新。
参考:
apcupsd官方文档
EEPROM部分
apctest命令部分
注意:
1.官方文档最后编辑时间显示是2016年,但是其中有的内容还是2003年写的,较新版本已经有一定的变化。
2.官方文档提示:尽量减少改变EEPROM的次数,以防止意外
We recommend that you change the EEPROM as little as is absolutely necessary since it is a somewhat delicate process that has occasionally produced problems (i.e. improper EEPROM values are displayed after the update).