インストールメモ

[upsd APC Smart-UPS SU700J]


1.アーカイブの取得
	ftp.rthunter.gr.jp/pub/unix/src/ups/upsd-2_0-100v_tar.gz


2.アーカイブの解凍、展開

	% gzip -d upsd-2_0-100v_tar.gz
	% tar -xvf upsd-2_0-100v_tar


3.インストール
  展開したディレクトリに移動し、make, make install を実行する。

	# cd upsd-2.0
	# make
	# make install

  すると /etc の下に upsd と upsd.conf upsd.restart がインストールされ、syslog.conf が書き換え
  られる。
  これで upsd はインストールされたので、好みに応じて upsd.conf を書き換える。
  /usr/local/sbin/upsd がインストールされるが、必要無いので消してしまおう。

	# rm /usr/local/sbin/upsd

  なお、make install 時に /usr/local/sbin が無い場合には、upsd が /usr/local/sbin となってイン
  ストールされてしまいます。 インストーラのバグなので気にせず削除しましょう。


4.upsd.conf の修正
  インストールした状態でも動作はしますが、アラームの設定や、シャットダウンまでの時間の指定など
  を変更したい場合は upsd.conf を修正します。

	# vi /etc/upsd.conf

  今回は下記の要に変更しました。

	# upsd.conf,v 2.0 1999/12/24 for Smart-ups700
	#
	# UPS Daemon
	# The Wild Wind Communications, 1995, 1996

	ups "smart-ups700" (100) proto "apc-smart700" {
		device			"/dev/ttyd0"
		speed			2400
		read-timeout		2
		write-block-size	1
		write-block-delay	50
		queue-size		64
	}

	every 45 {
		poll "line-voltage"
		poll "line-frequency"
		poll "line-maxvac"
		poll "line-minvac"
		poll "temperature"
	}

	on "initialize" != "SM" {
		poll "initialize"
		after 60 every 60 {
			log emerg "Cannot put the UPS into smart mode!"
		}
	}

	every 600 {
		tune "high-transfer-point"		110
		tune "low-transfer-point"		90
		tune "line-alarm"			"0"
		tune "line-sensitivity"			"L"
		tune "low-batteries-duration"		2
	#	tune "nominal-voltage"			100
		tune "shutdown-delay"			20
	#	tune "wakeup-batteries-capacity"	15
		tune "wakeup-delay"			0
	#	tune "batteries-replaced"		"01/01/77"
	#	tune "label"				"WildWind"
	}

	every 600 {			# poll the UPS
	#	poll "last-test"
	#	poll "light-test"
		poll "line-frequency"
		poll "line-maxvac"
		poll "line-minvac"
		poll "line-voltage"
		poll "load"
		poll "recharge"
		poll "temperature"
		poll "vdc"
		poll "voltage"
	}

	on "line-fail" every 30 {
		log emerg "*** ALERT! Source power line failed ***"
	}

	on "line-restore" {
		log emerg "*** Source power line restored ***"
	}

	#on "line-fail" after 120 {
	on "batteries-low" after 3 {
		log emerg "*** ALERT! THE SYSTEM IS SHUTTING DOWN! ***"

		poll "shutdown"
		poll "shutdown"
		poll "power-test"
		poll "power-test"
		poll "shutdown"
		poll "shutdown"

		sleep 2

		exec "/sbin/halt &"

		poll "power-test"
		poll "shutdown"
		poll "power-test"
		poll "shutdown"
		poll "power-test"
		poll "shutdown"
		poll "power-test"

		sleep 1000	# let us wait peacefully
	}


5.自動起動スクリプトの作成
  /etc/rc.local に以下の行を追加して、自動起動する要にしておきましょう。

	######## upsd-2.0 ########
	/etc/upsd
	echo 'upsd start'
	##########################

<参考> http://www.ysyslab.co.jp/~kondo/apc-100v.html