In order for dnsmasq to maintain its DHCP lease information, persistent storage, (such as USB) is needed. This isn't a scripting method/example per se. It may not be what you're looking for.
Navigate to DHCP/DNS under the Advanced menu. In the Dnsmasq Custom configuration field, enter:
Use a path relative to your own system. Click Save.
This can be useful, for example, when devices are connected to a switch. They won't lose network connectivity if the router is down (rebooted). They won't display as having an active lease in the Device List until their current lease expires, and they request a new one. FreshTomato will just continue where if left off.