...especially under Linux.
UPS used to come with a tiny RJ-11 connector to attach to your Windows host in order to tell special software when to shut down gracefully. This didn't work for Linux. Since the advent of USB to replace the RJ-11 and the creation of special drivers, this is now possible.
Of course, when you get to the real Linux steps, if you're running Windows, there's just the software that comes with the APC UPS to install. I don't think I really need to cover that.
What you need is a UPS that is specifically designed to perform shut-down. Schneider Electric's APC SmartUPS line satisfies this.