I saw your subject line and thought you were referring to UPS the parcel destroyer, and thought, gee that's a silly question. I have very low expectations of UPS. On topic now, I think there is a nice utility called apcupsd that can do this. It also should allow multiple servers connected to a UPS to be able to shutdown cleanly in the event of battery exhaustion.