This assume you want 24V 5A DC output and not the usual 120V or 240V ACvoltage output.
While most UPS selling on eBay output AC, I much doubted one can buy a 24V 5A DC output UPS from eBay.
Your problem is:
1. Charge batteries and stop charging when batteries full
2. Support a load of 24V, up to 5A all the time
What you'll need is those GEL battery, either single 24V or two 12V in series. These batteries use constant voltage charging and will not get overcharged if you follows the manufacturer's charging requirement exactly. So one problem solved.
Then there is a small problem about the total system voltage. It is now much higher than 24V, may be 27.2V. One would need a voltage regulator circuit to regulate this 27.2V down to 24V for your load, if they cannot take 27V directly. This can be done using a MOSFET to drop off 3.2V when the AC supply is healthy and the MOSFET is switched hard-on when the AC supply is lost.