The problem of state in live trading

I started to work on a live trading app and stumbled upon a problem which is not really that obvious in backtesting - how to deal with the situations when the app does not run continuously, because ie. it has to be scheduled to run at a specific time of day, week, or month, or it gets interrupted by some sort of failure, so it needs to be restarted and pick up from where it dropped. I am not sure if there is any algo-trading library with a direct support for something like that, but it could probably be achieved through hacking, ie. by setting portfolio, cash, active orders etc. when initializing the app. I was wondering if anyone faced the same problem and has some helpful insights to share.