How do I automatically re-submit a model, which failed due to a solver license error?

Q: I have a batch job consisting of a large number of gams models to be run, each of these requiring cplex. I am running this on my faculty's it system, where we share a number of licenses. It varies a lot how many is available, but sometimes none are available. This answer is returned to gams, which outputs this and terminates. That is very unfortunate for my application and I would very much prefer if it waits until a license becomes available. So my question is, can some flag be set for either cplex or gams, telling gams to keep trying to find a license?

You can program this into your GAMS program. The GAMS/CPLEX-link returns with a license error in the solver status. If this happens, you could put your model to sleep for x seconds and try again: