Home > Net >  How can I run a .sh script on Google Cloud Shell on schedule?
How can I run a .sh script on Google Cloud Shell on schedule?

Time:10-14

I have a .sh script in Google Cloud Shell that automates my instance shutdown, backup, restart sequence.

How can I run a .sh script on Schedule (i.e. daily) in a simplest possible way?

I am not a professional and I've read all documentation about cron jobs, Cloud Scheduler, Cloud Tasks... but none of the examples in the documentation appear to detail a simple task that I need, and I do not have enough knowledge yet to understand these multiple services in details.... I just need a simple direction pointer to understand how to connect my Google Cloud Shell .sh script with any form of scheduler, as in:

Run a .sh script that I have in my virtual 5gb Cloud Sell Storage on schedule (daily at specific time), instead of manually opening Google Cloud Console and using a terminal to run the same script with "bash" command?

I just need to know what I need to learn/do to make this happen.

Thank you for your input.

CodePudding user response:

That's not going to be possible. The Cloud Shell will turn off shortly after you close the tab. For this you'll need to use an actual VM. You can run one for free using the e2 micro instance.
https://cloud.google.com/free/docs/gcp-free-tier/#compute

Once you got this setup you can learn crontab to run your script on a schedule.

  • Related