you can easily do it with a single relay
one like this would do it...
http://www.ebay.co.uk/itm/AC-CONTACTOR-4kw-240V-COIL-3-POLE-1N-C-AUX-CONTACT-STARTER-CHINT-NC1-0901-240V-/272457680296?hash=item3f6fbe45a8:g:vfsAAOSwzchXRYZIit has 3 normally closed contacts and 1 normally open
if you look at the pic of it you'll see they're numbered 1, 3, 5 and 21 along the top, then 2, 4, 6, 22 along the bottom
there's a coil built into the base of it, give it 240v ti switches the contacts on/off (think of it like a big 12v car relay)
normally 1, 3 and 5 do nothing, 21 is connected to 22
then when you power it on, 1 connects to 2, 3 to 4, 5 to 6, and 21/22 disconnect
the contactor is switched by contacts A1 and A2, positive and negative (doesn't matter which one is which)
you need to connect your backup/constant positive into no21
and your other supply into no1
your on/off supply also connects to A1 to switch the relay on/off
join A2 to negative
join numbers 2 and 22 together and connect your load to them
then join all the negatives together (only need to switch the live)
:-)
EDIT:
rough picture to explain it better than I can with words

only thing I can think you might want is a little time delay relay, so it waits 30sec when you're on/off supply comes back on before it starts to use it ?