Sorry to double post. Are you planning to use rechargeable batteries? For something as intermittent as this with low power draw, alkaline might work just fine. Also, how do you plan to get 5V out? It's not a standard battery voltage.
Have you considered using a power supply ORing controller? The ICL7673 might be a good fit for you; take a look at figure 11 on page 7 of
https://www.intersil.com/content/dam/Intersil/documents/icl7/icl7673.pdfThe LTC4412 is also purpose made for this sort of thing. See Figure 2 on page 10 of
http://www.analog.com/media/en/technical-documentation/data-sheets/4412fb.pdfIf you would rather make your own out of discrete components, I fully understand the impulse.
Edit: I read the other posts a little more carefully. You're planning to use Li-Ion. Do you want to charge the battery/batteries manually as needed, or do you want to make a charging circuit? (There are ICs available for this).
If you want to make a charging circuit, I recommend a similar approach to the one I took. Since you have 5V out, if you use 2 Li-Ion cells in series, you can diode wire your cell stack and a wall adapter into the input of a 5V out buck converter. Then you can choose any adapter voltage higher than the cell stack maximum voltage and an appropriate charger IC. I would recommend buying a premade 2 cell Li-Ion pack with an integrated protection circuit.
If you want to go single cell, it's easier to find charging circuits. Single-cell charger chips vary, but many of them are designed to run from USB power (~5V). You could then use a 5V adapter. You'll need a boost converter to get 5V out of a single cell, preferably with a logic-level enable pin. I would configure the setup to turn the boost converter on by default and have a Pmos transistor between the 5V adapter and load that is off by default. Then I would power some small circuit from the 5V adapter before the Pmos transistor that would turn off the boost converter and turn on the Pmos transistor whenever the 5V adapter has high enough output. Again, I recommend a Li-Ion cell with an integrated protection circuit.