特殊:Badtitle/NS100:Apcupsd:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
第1行: 第1行:
{{From|https://help.ubuntu.com/community/apcupsd}}
{{From|https://help.ubuntu.com/community/apcupsd}}
{{Languages|UbuntuHelp:apcupsd}}
{{Languages|UbuntuHelp:apcupsd}}
Apcupsd is the daemon which will monitor your UPS to shutdown the system when the UPS' power is going to fail.  The homepage for apcupsd, http://www.apcupsd.com/, has very helpful documentation for doing complicated setups.
Apcupsd is the daemon which will monitor your UPS to shutdown the system when the UPS' power is going to fail.  The homepage f<pre><nowiki>apcupsd</nowiki></pre>ttp://www.apcupsd.com/, has very helpful documentation for doing complicated setups.
=== Prerequsites ===
=== Prerequsites ===
* An APC UPS. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office.
* An APC UPS. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office.
=== Installation ===
=== Installation ===
First of all, we have to install apcupsd package. Install the <code><nowiki>apcupsd</nowiki></code> package in the Synaptic Package Manager. See [[UbuntuHelp:SynapticHowto]]. If you want to see the stat of the UPS through the browser, you can also install <code><nowiki>apcupsd-cgi</nowiki></code> package.
First of all, we have to install apcupsd package. Install the <code><nowiki>apcupsd</nowiki></code> package in the Synaptic Package Manager. See [[UbuntuHelp:SynapticHowto]]. If you want to see the stat of the UPS through the browser, you can also install <pre><nowiki>apcupsd-cgi</nowiki></pre> package.
Edit the file <code><nowiki>/etc/apcupsd/apcupsd.conf</nowiki></code> which by default includes good comments on usage:
Edit the file <pre><nowiki>/etc/apcupsd/apcupsd.conf</nowiki></pre> which by default includes good comments on usage:
* For <code><nowiki>UPSCABLE</nowiki></code> you have to specify the type of cable connecting the UPS to your computer. Read the comments in the file to see which possibilities you have. For example, if the UPS used is the APC Back-UPS ES 700V, you have to write <code><nowiki>usb</nowiki></code>.
* For <pre><nowiki>UPSCABLE</nowiki></pre> you have to specify the type of cable connecting the UPS to your computer. Read the comments in the file to see which possibilities you have. For example, if the UPS used is the APC Back-UPS ES 700V, you have to write <pre><nowiki>usb</nowiki></pre>.
* You must also look for and modify the <code><nowiki>UPSTYPE</nowiki></code>.  The comments in the file describes the different possibilities available.  You may choose the appropriate one.  Again, from our example of an APC Back-UPS ES 700V, you would write <code><nowiki>usb</nowiki></code>.
* You must also look for and modify the <pre><nowiki>UPSTYPE</nowiki></pre>.  The comments in the file describes the different possibilities available.  You may choose the appropriate one.  Again, from our example of an APC Back-UPS ES 700V, you would write <pre><nowiki>usb</nowiki></pre>.
* The final setting you must fix is <code><nowiki>DEVICE</nowiki></code>.  As the comments note, with a <code><nowiki>usb</nowiki></code> type UPS apcupsd can autodetect the device, so you should comment out the <code><nowiki>DEVICE</nowiki></code> setting (by putting a '#' in front of it). Otherwise, you will need to know which <code><nowiki>/dev</nowiki></code> node your device is connected to.  If your UPS cable is a serial type then your device may be something like <code><nowiki>/dev/ttyS0</nowiki></code>.
* The final setting you must fix is <pre><nowiki>DEVICE</nowiki></pre>.  As the commen<pre><nowiki>no</nowiki></pre> with a <pre><nowiki>usb</nowiki></pre> type UPS apcupsd can autodetect the device, so you should comment out the <pre><nowiki>DEVICE</nowiki></pre> setting (by putting a '#' in front of it). Otherwise, you will need to know which <pre><nowiki>/dev</nowiki></pre> node your device is connected to.  If your UPS cable is a serial type then your device may be something like <pre><nowiki>/dev/ttyS0</nowiki></pre>.
Then you must edit the file <code><nowiki>/etc/default/apcupsd</nowiki></code> and change the <code><nowiki>no</nowiki></code> of the <code><nowiki>ISCONFIGURED</nowiki></code> with a <code><nowiki>yes</nowiki></code>.
Then you must edit the file <pre><nowiki>/etc/default/apcupsd</nowiki></pre> and change the <code><nowiki>no</nowiki></code> of the <pre><nowiki>ISCONFIGURED</nowiki></pre> with a <pre><nowiki>yes</nowiki></pre>.
Once you have apcupsd configured, running and the device connected to your computer you will be able to check on the status of the device using the <code><nowiki>apcaccess</nowiki></code> command.  Output from the command will vary based on the type of UPS you have.  Most likely, the better the UPS the more detailed the information you will get.
Once you have apcupsd configured, running and the device connected to your computer you will be able to check on the status of the device using the <pre><nowiki>apcaccess</nowiki></pre> command.  Output from the command will vary based on the type of UPS you have.  Most likely, the better the UPS the more detailed the information you will get.
Optionally, if you want your computer to reboot after a power fail, you must edit the <code><nowiki>/etc/init.d/halt</nowiki></code> due a bug that it has. You must change the <code><nowiki>poweroff="-p"</nowiki></code> with <code><nowiki>poweroff=""</nowiki></code>
Optionally, if you want your computer to reboot after a power fail, you must edit the <pre><nowiki>/etc/init.d/halt</nowiki></pre> due a bug that it has. You must change the <pre><nowiki>poweroff="-p"</nowiki></pre> with <pre><nowiki>poweroff=""</nowiki></pre>
The following applies to Drapper Drake (LTS 6.06)[Might also apply to later releases]
The following applies to Drapper Drake (LTS 6.06)[Might also apply to later releases]
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

2007年12月6日 (四) 10:03的版本

{{#ifexist: :Apcupsd/zh | | {{#ifexist: Apcupsd/zh | | {{#ifeq: {{#titleparts:Apcupsd|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Apcupsd|1|-1|}} | zh | | }}

Apcupsd is the daemon which will monitor your UPS to shutdown the system when the UPS' power is going to fail. The homepage f

apcupsd

ttp://www.apcupsd.com/, has very helpful documentation for doing complicated setups.

Prerequsites

  • An APC UPS. Apcupsd works with most of APC's Smart-UPS models as well as most simple signalling models such a Back-UPS, and BackUPS-Office.

Installation

First of all, we have to install apcupsd package. Install the apcupsd package in the Synaptic Package Manager. See UbuntuHelp:SynapticHowto. If you want to see the stat of the UPS through the browser, you can also install

apcupsd-cgi

package. Edit the file

/etc/apcupsd/apcupsd.conf

which by default includes good comments on usage:

  • For
    UPSCABLE
    you have to specify the type of cable connecting the UPS to your computer. Read the comments in the file to see which possibilities you have. For example, if the UPS used is the APC Back-UPS ES 700V, you have to write
    usb
    .
  • You must also look for and modify the
    UPSTYPE
    . The comments in the file describes the different possibilities available. You may choose the appropriate one. Again, from our example of an APC Back-UPS ES 700V, you would write
    usb
    .
  • The final setting you must fix is
    DEVICE
    . As the commen
    no
    with a
    usb
    type UPS apcupsd can autodetect the device, so you should comment out the
    DEVICE
    setting (by putting a '#' in front of it). Otherwise, you will need to know which
    /dev
    node your device is connected to. If your UPS cable is a serial type then your device may be something like
    /dev/ttyS0
    .

Then you must edit the file

/etc/default/apcupsd

and change the no of the

ISCONFIGURED

with a

yes

. Once you have apcupsd configured, running and the device connected to your computer you will be able to check on the status of the device using the

apcaccess

command. Output from the command will vary based on the type of UPS you have. Most likely, the better the UPS the more detailed the information you will get. Optionally, if you want your computer to reboot after a power fail, you must edit the

/etc/init.d/halt

due a bug that it has. You must change the

poweroff="-p"

with

poweroff=""

The following applies to Drapper Drake (LTS 6.06)[Might also apply to later releases]


You need to uncomment the line 10 in file "/etc/apcupsd/killpower" which means change:

  1. mount -n -o ro /usr

to mount -n -o ro /usr This will ensure that the shared libraries libcrypto.so.0.9.8, libnetsnmp.so.9, libstdc++.so.6 and libz.so.1 are visible to apcupsd after shutdown when it runs "/etc/apcupsd/apccontrol killpower" to shut off the ups power otherwise the UPS will stay on and your system will not automatically reboot when utility power returns.