I cheat. I have a UPS that, should the power fail, is set to give me five minutes to decide what to do before it starts hibernating my computer. If I, say, have ten or fifteen minutes left to finish a task, I can get into the UPS' power settings and reset it to allow me to keep working. Right now, I have an estimated 116 minutes run time. If what I'm doing is working the CPU or GPU harder than usual, I would have less runtime but still have plenty of time to wrap things up, then manually shut down. If I'm busy elsewhere, the UPS will just hibernate my computer five minutes after the power goes off. That way, I won't lose any work in progress other than, maybe, downloads. My modems and router are in a different room. One of these days, I need to get a smaller UPS for them.