.\" .\" Copyright 2003 John De Boskey .\" David Quattlebaum .\" All Rights Reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY JOHN DE BOSKEY & DAVID QUATTLEBAUM .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JOHN DE BOSKEY .\" OR DAVID QUATTLEBAUM BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED .\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR .\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE .\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" .\" $Id: apcpwr.8,v 1.1 2003/07/01 23:55:42 jwd Exp $ .\" .Dd April 1, 2003 .Dt APCPWR 8 .Os .Sh NAME .Nm apcpwr .Nd control power on/off/reboot via an APC MasterSwitch .Sh SYNOPSIS .Nm .Ar list .Nm .Ar probe .Nm .Op Fl f .Ar on outletname .Nm .Op Fl f .Ar off outletname .Nm .Op Fl f .Ar reboot outletname .Sh DESCRIPTION The .Nm utility is used to control power to systems connected to an APC MasterSwitch power distribution unit. The following option is available for script usage: .Bl -tag -width ".It Fl f" .It Fl f Force the operation to occur without asking for final confirmation before execution. .El .Sh COMMANDS .Pp The commands recognized by .Nm are as follows: .Bl -tag -width "reboot" .It Ar list produces a list of the known APC MasterSwitches and the information associated with each port. The outlet status is dynamically determined via snmp request each time the list command is executed. .Pp .It Ar probe produces the .db file (default: .Pa /var/db/apcpwr.db ). .It Ar on turns on the output specified by .Ar outletname .It Ar off turns off the output specified by .Ar outletname .It Ar reboot turns off the outlet specified by .Ar outletname for (a default of) 5 seconds and then turns it back on. .El .Sh EXAMPLES .Pp The following command: .Pp .Nm .Ar list .Pp produces a table listing all managed MasterSwitch units, the device name attached to each outlet, and it's status. .Bd -literal pdu1 (172.21.251.251) 1: triangle On 2: 8ball On 3: 9ball On 4: cueball On 5: avail-5 On 6: avail-6 On 7: avail-7 On 8: admin On .Ed .Pp .Nm .Ar reboot .Ar admin .Pp will turn off power for the system attached to pdu1, outlet 8, for (a default of) 5 seconds, and then automatically turn the power back on. Since the .Fl f option was not specified, the following text: .Pp .Dl "Are you sure? [y|N]:" .Pp will be printed to standard output and a positive response required before the operation will continue. .Pp .Nm .Ar probe .Pp A sample /etc/crontab entry to build the .db file via the .Ar probe command is: .Pp .Bd -literal # # Create /var/db/apcpwr.db # 0 21 * * * root /usr/local/bin/apcpwr probe > /dev/null .Ed .Sh FILES .Bl -tag -compact .It Pa /usr/local/etc/apcpwr.conf .It Pa /var/db/apcpwr.db .El .Sh SEE ALSO .Xr snmpwalk 8 , .Xr snmpget 8 , .Xr snmpset 8 .Sh CAVEATS These utilities are based upon the netsnmp port. Other snmp packages may work but are untested. .Pp The MIB file POWERNET344_MIB.txt is not required to use this port. However, if you with to debug this utility it must be copied from the provided media CD which came with the unit and installed into the correct MIB directory (in this instance: /usr/local/share/snmp/mibs).