How do I start and stop Genymotion SaaS virtual devices from a script with gmsaas?

Last verified against genymotion.com:

Use gmsaas instances start <RECIPE_UUID> <INSTANCE_NAME> to start a device, then gmsaas instances stop <INSTANCE_UUID> to stop it. The stop command must use the instance UUID, not the name, and devices started with gmsaas are not stopped by timeout. Automation Features · How to stop a virtual device in Genymotion SaaS?

Typical script flow:

gmsaas auth token <token>
gmsaas recipes list
gmsaas instances start <RECIPE_UUID> <INSTANCE_NAME>
gmsaas instances adbconnect <INSTANCE_NAME>
gmsaas instances stop <INSTANCE_UUID>

Important: if you start a device with gmsaas, you should stop it with gmsaas too, otherwise it can keep running. Automation Features · How to stop a virtual device in Genymotion SaaS?