Hello Iswar,
From the use case that you mentioned, I believe you can use the gcloud command to start/stop the services. And to utilize this command in the script, this article should be helpful. I hope it helps.
Furthermore, I should mention that Google Group is intended for more general questions, for more technical questions posting in the Stack Overflow should be helpful.