Powerchute v/s does not support Solaris (does not exist for Solaris) and APC wants to sell you Powerchute Plus or buy a regular Smart-UPS. Powerchute Plus does not allow you to put the UPS to sleep after a shutdown in signalling mode when connected to a v/s either.


customized software that monitors UPS for powerfail event. Upon receiving, the software watches for 5 minutes. If power is still out:

  1. unshareall
  2. sync
  3. unmount file systems
  4. shutdown

/etc/rc0.d/K99upsdown is a program that sends a signal over the serial line to the UPS telling it to turn itself off. When the power comes back on, the UPS turns the load on, and the machine brings itself back up automatically.

/etc/rc0.d/K99upsdown is a binary. The 5 minute timeout is configurable in the source of the program that monitors the UPS.


APC does not give you necessary cable to talk to the UPS properly and signal it in the right way. Their current wiring scheme makes no sense (except to make money by charging for a proprietary cable.


	custom DB-25 cable (both ends male)
	plugs into DB25 female to DB-9 male adapter included with UPS.

	Unix host				APC DB25	APC DB9
RTS	4					8		1 shutdown
CTS	5					3		2 linefail
GND	7					22		9 GND
DTR	20					2		3 extra

I had originally intended to have pin 20 on the Unix host wired to pin 4 which goes to pin 7 on the DB-9 which is the turn on/off input. However, I could not get the control I desired because our suns boot up with DTR asserted which would immediately power down the UPS and shut off the sun. Hence, the 20-2 wiring is not strictly necessary.

How it works:

The UPS asserts pin 2 on the DB9 which is wired to pin 3 on the UPS side of the RS-232 cable which is wired to pin 5 on the UNIX host. The unix host polls CTS. When CTS is asserted, the unix host begins the 5 minute countdown and generates a syslog message. If the power comes back on in the mean time, another syslog message is generated. If 5 minutes elapses, the Unix host does this:

	    (void) syslog(LOG_CRIT, "halting machine\n");
            system("/usr/sbin/unshareall");	/* un export file systems */
            system("/usr/sbin/sync");		/* sync file systems */
            system("/usr/sbin/presto -d");	/* disable prestoserve */
            system("/usr/sbin/sync");		/* another sync - be safe */
            system("/usr/sbin/umountall");	/* unmountall file systems */
            system("/usr/sbin/init 0");		/* shutdown */

K99upsdown is a simple C program that sets RTS for 8 seconds and then turns it back off again. The UPS recognizes this eventually on line 1 (8 on RS232) as the shutdown signal and turns off. The turn off is different than the turnoff invoked on pin 7 (4 RS232) in that when the power comes back on, the UPS turns the load back on and the machine attached to it will come back up.


If using a headless machine like a Sun that uses ttya for console when no keyboard is plugged in, the UPS must be plugged in to ttyb to avoid signalling problems between the UPS and the Sun. (A splitter cable may be required if you have a 10, 20, or equivalent). This is because the getty/ttymon program that typically runs on the console is now on ttya (term/a) and interferes with the signalling (back to that poor design thing).


ups.c (the monitoring program) and upsdown.c (K99upsdown) are available for anonymous ftp from in pub/doug.