UPSによる電源制御
ケーブル接続
apcupsdの設定メモを参考にAPC社製Smart-UPS 500とシリアル接続する。
portインストール
# portinstall -v sysutils/apcupsd
libiconvのportsインストール時にオプション選択があるので、両方とも[X]チェックする。
[X] EXTRA_ENCODINGS Include extra character sets [X] EXTRA_PATCHES Apply patches to fix CP932 add EUCJP-MS
apcupsdインストール時にOptions for apcupsd 3.14.4_1の画面は次のようにチェックする。
[X] APCSMART_DRV Compile APC SmartUPS serial driver [X] APCDUMB_DRV Compile dumb UPS driver [ ] CLIENT_ONLY Only NIS client (no network server or drivres) [X] CGI Compile with CGI programms to show status [X] PCNET_DRV Compile PowerChute Network Shutdown driver [ ] USB Compile with USB Support driver [ ] SNMP_DRV Compile with SNMP driver [X] TCP_WRAPPERS Compile with TCP_WRAPPERS support [ ] TEST_DRV Compile TEST driver [ ] GAPCMON Build GTK GUI front-end
設定ファイル編集
# cd /usr/local/etc/apcupsd/ # cp apcupsd.conf apcupsd.conf.orig # vi apcupsd.conf
設定した項目。シリアルケーブル接続、自動シャットダウン設定をした。
UPSNAME S-UPS500 ※任意 UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyd0 LOCKFILE /var/spool/lock ONBATTERYDELAY 6 BATTERYLEVEL 5 MINUTES 5 TIMEOUT 30 ANNOY 300 ANNOYDELAY 60 NOLOGON disable KILLDELAY 90 NETSERVER on NISIP 0.0.0.0 NISPORT 3551 EVENTSFILE /var/log/apcupsd.events EVENTSFILEMAX 10 UPSCLASS standalone UPSMODE disable STATTIME 0 STATFILE /var/log/apcupsd.status LOGSTATS off DATATIME 0
rc.confを編集
# vi /etc/rc.conf apcupsd_enable="YES" apcupsd_program="/usr/local/sbin/apcupsd"