BKPUPSD(8)

NAME
bkpupsd - Simple UPS daemon

SYNOPSIS
bkpupsd [-dhnpv] [-r number] [-s number] [-t seconds] [ups-type[:device]]

DESCRIPTION
The bkpupsd utility is a Simple Uninterruptable Power Source (UPS) daemon to control BK Pro series and BK series by American Power Conversion Corp, FREQUPS A/F series by Mitsubishi Electric Corp. And now, it should support UPS which detect its status and control it through serial port's modem control bits; DTR(Data Terminal Ready), RTS(Request To send), CTS(Clear To Send), CAR(CArrier Detect), RNG(Ring), DSR(Data Set Ready). The bkpupsd utility is designed to control UPS in dumb mode and never reads or writes any data on serial port but only checks modem bits' status.

For BK PRO and BK series, dual purpose cable 940-0095A or dumb mode cable 940-0020B are tested to work. Dual purpose cable 940-0095B are tested to work with some caution, see section.

For FREQUPS F series, the bundled cable is tested to work and dip switch #2 of FREQUPS must be set to on and dip switch #4 should be set to on.

For FREQUPS A series, dip switch #4 should be set to on and other dip switches should be off (default).

Other type cables aren't tested at all. Current specifications cable are follows:

UPS When the line power goes out, the UPS switches power source to battery and notify it through changing the serial port's signal.

    After line power goes out and if battery remaining becomes lower, the UPS notifies it through changing the serial port's signal.

    The UPS induces itself to shutdown mode when it gets some serial port's signal.

bkpupsd
    bkpupsd starts with ups name specified in the upstab(5) file on startup, and read parameter for corresponding ups. Then bkpupsd opens the serial port specified with command line option, and sets its status if needed.

    bkpupsd checks the serial port, changing of modem control bits periodcally. If it matches line power failure condition, bkpupsd runs the line.lost (power fail warning script) and reports the line power failure via syslog(3).

    If timeout is specified by -t option, and the line power failure continued more than this timeout value, bkpupsd runs the line.shutdown (shutdown script), reports via syslog(3), makes the UPS to sleep by setting corresponding modem control bits, and finally shutdowns the machine.

    While the UPS supplies power from the battery, and its remaining lower has detected, bkpupsd runs the battery.shutdown (emergency shutdown script) immediately, reports via syslog(3), and makes the UPS to sleep.

    If the line power recovers before the timeout or low battery condition, bkpupsd runs the line.recover (script for power recovery) and continues to monitor the serial port.

The options are as follow:

-d  Debug mode, don't detach terminal nor do fork(2).

-h  Show simple help message and exit.

-n  Test mode. With this option, bkpupsd dosen't execute external scripts at all nor don't sleep UPS.

-p  Specify that don't make UPS into sleep mode. (This option was experimental option past.)

-r  Specify the line recovery time in seconds by followed number.

-s  Specify local syslog facility by followed number; if you specify 1, then syslog uses LOG_LOCAL1 facility. Without -s option, LOG_DAEMON facility will be used.

-t  This option specifies the time in seconds by followed number. When line power has gone, UPS continues to supply power from the battery. If line power dosen't recover within this seconds, bkpupsd will shutdown the machine by the external script.

-v  Show version and exit.

ups-type[:device]
    specifies ups type and you can specify the device file for serial port to which it is attached. Default device is /dev/dty00 in NetBSD, /dev/cuaa0 in FreeBSD.

FILES

/usr/pkg/libexec/bkpupsd/battery.shutdown
    Shutdown script for battery failure

/usr/pkg/libexec/bkpupsd/line.lost
    Warning script for line power failure

/usr/pkg/libexec/bkpupsd/line.shutdown
    Shutdown script for line power failure

/usr/pkg/libexec/bkpupsd/line.recover
    Informing script for the line power restored

/var/run/bkpupsd.pid
    process id of current bkpupsd

NOTES
The interface cable must be compatible with manufacturer's interface kits.

The scripts can be modified ajusting your system. The recommanded file permissions for these scripts are "chmod root.wheel 700"(because anyone who can run these scripts also get the privilage of shutdonw the system). bkpupsd requires to be run in root privilage to execute the shell-scripts.

SEE ALSO
upstab(5),

BUGS
Command line options aren't backward compatible with previous version of bkpupsd.

If the power recover after the shutdown script run, the system shutdown will not be canceled, auto-restart may not performed and the system may be shutdowned until restart is invoked using reset switch.

Program's name, bkpupsd is somewhat historical.

AUTHOR
Yoshifumi Watanabe <mwatts@edu1.tokyo-med.ac.jp> wrote bkpupsd first, and almost rewritten by Takahiro Kambe <taca@back-street.net>.

HISTORY
The bkpupsd appeared after FreeBSD 2.2.1R, and should works on NetBSD 1.4 and later.