Table of Contents
upsd - shutdown in event of power failure
upsd
-V
upsd [ -d level | -v ] [ -ic ] [ -iw ] [ -is ] [ -pc program ] [ -pw program
] [ -ps program ] port
This man page documents upsd
version PATCHLEVEL_MARKER.
Upsd is intended to be run in the manner of
a daemon. It monitors the signal lines provided on an external UPS and
shuts down the machine in the event of a mains power failure.
In the event
of a mains power failure, upsd first calls wall (1) to regularly inform
users of the situation and of how much of the shutdown interval time
remains. Once this time has elapsed, upsd calls shutdown (8) with appropriate
options to immediately shut down the machine. In the event that mains power
is restored before the shutdown interval has elapsed, then upsd calls
wall (1) again to inform users of the change in situation.
Upsd honours
uucp (1) style lock files generated by other programs is capable of detecting
stale locks files.
Once upsd has processed all options and is about to
settle down to its monitoring cycle, then all notable events are recorded
via syslog (8).
- -V
- Print the version number and exit.
- -d level
- Sets the debug level. If level is set to 0, then not even error messages
will be reported. If level is set to 1, then only error messages will
be reported. If level is set to 2, which is the default, then error and
warning messages will be reported. If level is set to 3, then additional
informational messages will also be reported. If level is set to 4 or
greater then additional debugging messages are reported.
- -v
- Equivalent
to -d 3.
- -ic secs
- Sets the interval between mains power checks to secs
seconds. The default is 1 second.
- -iw secs
- Sets the intervals between warning
messages sent to users in the event of a mains power failure to secs
seconds. The default is 30 seconds.
- -is secs
- Sets the interval between mains
power failure and system shutdown to secs seconds. The default is 240
seconds.
- -pw program
- Specifies that program should be run when otherwise
a message would be sent to all users warning of an impending shutdown.
program is called without command line parameters but with status information
set in the environment. See ENVIRONMENT below for more details.
- -pc program
- Specifies that program should be run when otherwise a message would
be sent to all users informing them that the impending shutdown has been
cancelled. program is called without command line parameters but with
status information set in the environment. See ENVIRONMENT below for more
details.
- -ps program
- Specifies that program should be run when otherwise
the system would be shut down. program is called without command line
parameters but with status information set in the environment. See ENVIRONMENT
below for more details.
It is envisaged that upsd will be
started from /etc/rc.local (See rc (8)) with a command such as:
- /usr/local/bin/upsd
-is 300 /dev/tty00
or perhaps in a country where English is not the spoken
language:
- /usr/local/bin/upsd -is 300 -pw /usr/local/bin/upsd.warn -pc \
- /usr/local/bin/upsd.canc /dev/tty00
where the shutdown interval is
appropriate to the length of time that the UPS can deliver battery power
after a mains power failure.
Most of the messages produced
by upsd are self-explanatory, those that are not are described here:
- upsd: ERROR: can't find user 'uucp'
- Depending on the environment in which
upsd was built, upsd may try to set the owner of any lock file it creates
to 'uucp'. If such a user does not exist on your system then upsd will report
an error.
None.
- /etc/passwd
- Used to identify the
user 'uucp.'
- /var/spool/uucp/LCK..port
- Lock file created by upsd .
Upsd does not make use of any enviroment variables itself, but
does add the following to the enviroment before calling any of the programs
specified with the -pw , -pc or -ps options:
- UPSD_STATE
- Set to impending
, cancelled or immediate in correspondance with the shutdown scheduled
as a result of mains power failure.
- UPSD_INTERVAL
- If UPSD_STATE is set
to impending then this environment variable is set to the interval after
which the shut down will activated. The interval is measured in seconds.
shutdown(8), passwd(5), uucico(8), wall(1), write(1)
Very unstable, only just written!
Alexis Huxley <alexis@danae.demon.co.uk>
Upsd does not understand that after mains power has been restored
before the shutdown interval has elapsed, that the UPS will not be capable
of delivering battery power for the same warning interval should the mains
power fail a second time before the batteries in the UPS have been fully
recharged.
Secure support for shutting down remote
machines should be added.
Upsd should create a sensible /etc/nologin.
Table of Contents