nutupsdrv \- generic manual for unified NUT drivers
.SH"SYNOPSIS"
.sp
\fBnutupsdrv\fR\fI\-h\fR
.sp
\fBnutupsdrv\fR [OPTIONS]
.SH"DESCRIPTION"
.sp
\fBnutupsdrv\fR is not actually a driver\&. This is a combined man page for the shared code that is the core of many drivers within the Network UPS Tools package\&.
.sp
For information on the specific drivers, see their individual man pages\&.
.sp
UPS drivers provide a communication channel between the physical UPS hardware and the \fBupsd\fR(8) server\&. The driver is responsible for translating the native protocol of the UPS to the common format used by the rest of this package\&.
The core has three modes of operation which are determined by the command line switches\&. In the normal mode, the driver will periodically poll the UPS for its state and parameters, as per the \fBpollinterval\fR parameter in \fBups.conf\fR(5)\&. The results of this command are presented to upsd\&. The driver will also handle setting variables and instant commands if available\&.
In the second mode, using \fB\-k\fR, the driver can instruct the UPS to shut down the load, possibly after some delay\&. This mode of operation is intended for cases when it is known that the UPS is running out of battery power and the systems attached must be turned off to ensure a proper reboot when power returns\&.
.sp
In the third mode, using \fB\-d\fR, the driver will exit after some update loops, dumping the data tree (in upsc\-like format) to stdout\&. This can be useful to complement the nut\-scanner to discover devices, along with in\-depth data\&.
You probably don\(cqt want to use any of these options directly\&. You should use \fBupsdrvctl\fR(8) to control your drivers, and \fBups.conf\fR(5) to configure them\&. The rest of this manual describes options and parameters that generally are not needed by normal users\&.
.sp.5v
.RE
.SH"OPTIONS"
.PP
\fB\-h\fR
.RS4
Display a help message without doing anything else\&. This will also list possible values for
\fI\-x\fR
in that driver, and other help text that the driver\(cqs author may have provided\&.
.RE
.PP
\fB\-a\fR\fIid\fR
.RS4
Autoconfigure this driver using the
\fIid\fR
section of
\fBups.conf\fR(5)\&.
\fBThis argument is mandatory when calling the driver directly\&.\fR
Raise the debugging level\&. Use this multiple times to see more details\&. Running a driver in debug mode will (by default) prevent it from backgrounding after startup\&. It will keep on logging information to the console until it receives a SIGINT (usually Ctrl\-C) or SIGTERM signal\&.
The level of debugging needed depends both on the driver and the problem you\(cqre trying to diagnose\&. Therefore, first explain the problem you have with a driver to a developer/maintainer, before sending them debugging output\&. More often than not, if you just pick a level, the output may be either too limited or too verbose to be of any use\&.
Dump the data tree (in upsc\-like format) to stdout after running the driver update loop for
\fIupdate_count\fR
times and exit\&. By default this prevents the driver process from backgrounding after startup\&. Note that the driver banner will be printed too, so when using this option in scripts, don\(cqt forget to trim the first line\&.
("Kill" power) Forced shutdown mode\&. The UPS will power off the attached load, if possible\&.
.sp
You should use
upsdrvctl shutdown
whenever possible instead of calling this directly\&.
.RE
.PP
\fB\-r\fR\fIdirectory\fR
.RS4
The driver will chroot(2) to
\fIdirectory\fR
during initialization\&. This can be useful when securing systems\&.
.sp
In addition to the state path, many systems will require /dev/null to exist within
\fIdirectory\fR
for this to work\&. The serial ports are opened before the chroot call, so you do not need to create them inside the jail\&. In fact, it is somewhat safer if you do not\&.
Override the unprivileged username that the driver may use after startup\&. If started as root, after opening configuration files (and optionally calling chroot(2), as described in the previous option), the driver will look up
\fIusername\fR
in the
passwd
database, then change to the user and group identities associated with
\fIusername\fR\&. (If started with a nonzero UID or effective UID, the driver will silently ignore this option\&.)
When compiling NUT from source, the default username is typically
nobody, and this may cause permission errors when the driver opens the UPS device node\&. You can use this option to temporarily override the defaults\&. For testing purposes, you can set this option to
root
to bypass permission errors, especially with USB\-based drivers\&. However, you will want to remove this option later in order to avoid permission conflicts between the driver and the unprivileged copy of
\fBupsd\fR(8)\&.
.RE
.PP
\fB\-g\fR\fIgroupname\fR
.RS4
Override the unprivileged group name that the driver may use after startup to set permissions for the filesystem socket so
in the driver\&. This varies from driver to driver \- see the specific man pages for more information\&.
.sp
This is like setting
\fIvar\fR=\fIval\fR
in
\fBups.conf\fR(5), but
\fB\-x\fR
overrides any settings from that file\&.
.RE
.SH"DIAGNOSTICS"
.sp
Information about the startup process is printed to stdout\&. Additional messages after that point are available in the syslog\&. After \fBupsd\fR(8) starts, the UPS clients such as \fBupsc\fR(8) can be used to query the status of an UPS\&.
.SH"PROGRAM CONTROL"
.sp
You should always use \fBupsdrvctl\fR(8) to control the drivers\&. While drivers can be started by hand for testing purposes, it is not recommended for production use\&.
.SH"FILES"
.PP
ups\&.conf
.RS4
Required configuration file\&. This contains all details on which drivers to start and where the hardware is attached\&.
\fBNUT_CONFPATH\fR is the path name of the directory that contains upsd\&.conf and other configuration files\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /usr/local/ups/etc\&.
.sp
\fBNUT_STATEPATH\fR is the path name of the directory in which \fBupsd\fR keeps state information\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /var/state/ups\&. The \fBSTATEPATH\fR directive in \fBupsd.conf\fR(5) overrides this variable\&.
.sp
\fBNUT_ALTPIDPATH\fR is the path name of the directory in which \fBupsd\fR and drivers store \&.pid files\&. If this variable is not set, \fBupsd\fR and drivers use either \fBNUT_STATEPATH\fR if set, or ALTPIDPATH if set, or otherwise the built\-in default \fBSTATEPATH\fR\&.