|
When I've done this in the past I've designed the script so that it writes it's state to an INI file, so if (for example) the process is killed off when it next starts it loads it's state information from the INI file and continues.
Another technique is to simple dump the variables / state information out to a KiXtart mini-script that can then be CALLed to reinitialise the process. This works well as long as you don't have really complex variables like objects.
Looking at what you've got I'd be inclined to simply start a second dispatcher process which manages new tasks and leaves the old one managing extant tasks. When the old tasks all complete the original dispatcher can either exit or just go into hibernation.
Another, maybe simpler solution is to have your initially launched script process to be *really* dumb. The only thing it does is to launch the dispatcher and then wait. When the dispatcher exits, your dumb process relaunches it. This will allow you to keep the dumb bootstrap process so simple that you shouldn't ever need to change it, while allowing you to refresh the running dispatcher process with new updates.
|