upsd release 03/30/91 version 1.0 patchlevel 3 Pg. 1 INTRODUCTION The UPS monitor daemon or "upsd" watches the serial port connected to an UPS and will perform an unattended shutdown of the system if the UPS is on battery longer than a specified number of minutes. Upsd needs to watch a tty with modem control properties, and expects the UPS to raise DCD when it switches to battery backup and drop DCD when it goes back to online. Upsd was developed and tested under ISC with the FAS 2.08 driver and an American Power Conversion SmartUPS 600, your milage may vary on other OSes and UPSes. The C source was written for system V and hence will require some work to get it working under BSD or other UNIXes, the program is built via the Makefile. A number of configurable defaults are in common.h, you may want to hack that file before making upsd. Although the program can be run manually from the command line, users will most likely want the program to start automatically from their /etc/rc script (SYS5R2) or a script in /etc/rc2.d (SYS5R3). The Makefile by default installs upsd in the /etc directory when the install target is made. upsd release 03/30/91 version 1.0 patchlevel 3 Pg. 2 COMMAND LINE OPTIONS Upsd runtime behavior can be configured either on the command line or via environment variables. The command line options take precedence to the environment variable settings, and are as follows: usage: upsd [-d tty][-c cmd][-l file][-t min][-f file][-r file] -d tty pathname of UPS device -c cmd pathname of shutdown command -l file pathname of UPS log file -f file pathname of UPS fail message file -r file pathname of UPS restore message file -t min delay time in minutes The -d tty option must specify the full pathname (including the /dev/ prefix) to the tty device the UPS is on. Example: upsd -d /dev/ttyFM00 The -c cmd option specifies the full pathname of the command to be executed to shut down the system. This command must be enclosed in quotes if it consists of 2 or more words. Example: upsd -c "/etc/shutdown -y -i0" The -l option specifies the logfile upsd will write it's event messages to, these messages give the date and time that the UPS daemon started, switched to battery, switched back to online, executed the shutdown command, or was terminated via SIGTERM. Example: upsd -l /etc/upslog The -f option specifies the path name of the failure message file to broadcast to all users in the event of a power failure. The failure message file is simply an ASCII text file which you can create with an editor such as vi(1). If the file is not found by upsd, no message will be broadcast upon power failure. Example: upsd -f /etc/upsfail The -r option specifies the path name of the restore message file to broadcast to all users in the event of power restore. The restore message file is simply an ASCII text file which you can create with an editor such as vi(1). If the file is not found by upsd, no message will be broadcast upon power restore. Example: upsd -f /etc/upsrest Finally, the -t option specifies the number of minutes to allow the UPS to be on battery backup before executing the shutdown sequence. This number must be between 1 and 30. Be careful not to choose a value greater than the number of minutes of battery time your UPS supports with your current load. A value in the 5 to 10 minute range is probably sufficient. Example: upsd -t 10 upsd release 03/30/91 version 1.0 patchlevel 3 Pg. 3 ENVIRONMENT VARIABLES The following environment variables can be set if that interface is preferred to the command line options. Note again that command line options override the environment variable settings. Environment Equivalent Default Variable Command line option Value UPSPORT -p /dev/ttyFM00 UPSSHUT -c "/etc/shutdown -y -i0" UPSLOG -l /etc/upslog UPSFAIL -f /etc/upsfail UPSREST -r /etc/upsrest UPSTIME -t 10 Note that the compiled in default values can be altered in common.h and the program can be recompiled. If no command line options or environment variables exist, the defaults will be used. The table above gives the environment variables looked for by the program and their command line option counterparts. All the rules applying to the command line options apply to the environment variables as well. If you have any comments or suggestions regarding my program, send email to the following address: Arthur W. Neilson III INET: art@pilikia.pegasus.com UUCP: uunet!ucsd!nosc!pilikia!art
Tue Apr 02 23:24:20 HST 1991 art@pilikia.pegasus.com Pg. 1 INTRODUCTION The UPS monitor daemon or "upsd" watches the serial port connected to an UPS and will perform an unattended shutdown of the system if the UPS is on battery longer than a specified number of minutes. Upsd needs to watch a tty with modem control properties, and expects the UPS to raise DCD when it switches to battery backup and drop DCD when it goes back to online. Upsd was developed and tested under ISC with the FAS 2.08 driver and an American Power Conversion SmartUPS 600, your milage may vary on other OSes and UPSes. The C source was written for system V and hence will require some work to get it working under BSD or other UNIXes, the program is built via the Makefile. A number of configurable defaults are in common.h, you may want to hack that file before making upsd. Although the program can be run manually from the command line, users will most likely want the program to start automatically from their /etc/rc script (SYS5R2) or a script in /etc/rc2.d (SYS5R3). The Makefile by default installs upsd in the /etc directory when the install target is made. Tue Apr 02 23:24:20 HST 1991 art@pilikia.pegasus.com Pg. 2 COMMAND LINE OPTIONS Upsd runtime behavior can be configured either on the command line or via environment variables. The command line options take precedence to the environment variable settings, and are as follows: usage: upsd [-d tty][-c cmd][-l log][-t min] -d tty pathname of UPS device -c cmd pathname of shutdown command -l log pathname of UPS log file -t min delay time in minutes The -d tty option must specify the full pathname (including the /dev/ prefix) to the tty device the UPS is on. Example: upsd -d /dev/ttyFM00 The -c cmd option specifies the full pathname of the command to be executed to shut down the system. This command must be enclosed in quotes if it consists of 2 or more words. Example: upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0" The -l option specified the logfile upsd will write it's event messages to, these messages give the date and time that the UPS daemon started, switched to battery, switched back to online, executed the shutdown command, or was terminated via SIGTERM. Example: upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0" -l /etc/upslog Finally, the -t option specifies the number of minutes to allow the UPS to be on battery backup before executing the shutdown sequence. This number must be between 1 and 30. Be careful not to choose a value greater than the number of minutes of battery time your UPS supports with your current load. A value in the 5 to 10 minute range is probably sufficient. Example: upsd -d /dev/ttyFM00 -c "/etc/shutdown -y -g1 -i0" -l /etc/upslog -t 10 Tue Apr 02 23:24:20 HST 1991 art@pilikia.pegasus.com Pg. 3 ENVIRONMENT VARIABLES The following environment variables can be set if that interface is preferred to the command line options. Note again that command line options override the environment variable settings. Environment Equivalent Default Variable Command line option Value UPSPORT -p /dev/ttyFM00 UPSSHUT -c "/etc/shutdown -y -g1 -i0" UPSLOG -l /etc/upslog UPSTIME -t 10 Note that the compiled in default values can be altered in common.h and the program can be recompiled. If no command line options or environment variables exist, the defaults will be used. The table above gives the environment variables looked for by the program and their command line option counterparts. All the rules applying to the command line options apply to the environment variables as well. If you have any comments or suggestions regarding my program, send email to the following address: Arthur W. Neilson III INET: art@pilikia.pegasus.com UUCP: uunet!ucsd!nosc!pilikia!art
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.