jcl
jcl

Reputation: 61

How to schedule a Cron job on the Google Cloud Platform?

Does anybody know of a barebones example for scheduling a Cron job on the Google Cloud Platform?

I have a simple python script (developed in a virtualenv in visual code) and I'm struggling to follow the examples provided by google.

The script make use of the Google Cloud client libraries (like google.cloud.storage and google.cloud.bigquery).

Any help much appreciated.

Upvotes: 4

Views: 8396

Answers (2)

Matthew P
Matthew P

Reputation: 735

You can now use Google Cloud Scheduler which is a fully managed (and cheap!) and much easier than setting up 'proper' Cron jobs. You can find it here: https://cloud.google.com/scheduler/

Upvotes: 2

Taavi
Taavi

Reputation: 135

One way of doing it would be to

  1. create a VM in the Compute Engine - read this
  2. connect to your instance - read this
  3. set up your cron job by modify the /etc/crontab file: $ nano /etc/crontab

When you are actually interested in starting a process once a new file is uploaded to the Storage, then you could look into setting up a Cloud Function which would do that: https://cloud.google.com/functions/docs/calling/storage

Upvotes: 1

Related Questions