@COSMOSUNIVERSE Buy a UPS (Uninterruptable Power Supply) - a cheap one will give you enough time to shut everything down before the UPS battery runs down. Or you could configure it to shut down automatically when the UPS cuts in. (We lose power around twice a year.)