Only UPS (Uninterrupted Power Supply). They have a battery to keep system running until proper power down is enacted. They also have to have a connection (other than power) to PC, with older one it was Serial (RS232) port and newer ones have USB.
When power is cut to UPS, it switches to battery power and signals PCs operating system to start shutdown sequence.