I think what Miguel is trying to say is that you should use a switch mode supply; the output is still present for about a second or so after the mains is switched off.
If you monitor the AC side of the PSU, you can monitor the the average time it takes for the AC signal to pass through zero and get back to supplying a voltage that would yield the required output. If the "zero time " is longer than normal, you have a power failure (zero time shouldn't be longer than 5ms on 50Hz or 4ms on 60 Hz; zero is @ 180deg, AC should peak again at 270deg which is a 1/4 of a cycle, thus 4 or 5 ms)
Thus if the mains is zero for longer than 5ms, switch your back-up PSU on. You should have the required output from the back-up before the output of the SMPS dies.