Turn Off Then On With Programming?

I’m not sure if this is possible but I figured if there was a way- someone here would know.

I have a constant vdc and a switched vdc. I want to be able to shut down the Arduino (Nano) 45 seconds after the switched power source is shut off (to save battery) and then power up the Arduino when the switched source comes back on.

Im pretty sure I can do this using a relay or diode or some other hack but Id rather do it all in programming if possible.

Does anyone have any suggestions? I really appreciate it!

(sorry for the crappy sketch and I know the wires are not going to the correct pins.)

https://www.youtube.com/watch?v=apVR5Htz0K4

HAHAHAHAAHAHAHA!!!! OMG that was funny! :)

I'm not sure I have the space for that type of solution but certainly a possibility :)

(deleted)

Well.... sort of but not really.

Maybe I'm just not going about it in the right way.

Say I want a battery powered gate opener, for example. Solar is not an option in this example. I drive up to the gate, push the button, the Arduino comes alive and you enter a password. The gate opens and closes behind you. After the gate is closed the Arduino shuts off until the button is pressed again (to conserve battery power).

Not my exact plan but sort of a simplified example.

(deleted)

FANTASTIC! Thank you so much!