Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a cron job on a Google Compute Engine instance via a PHP App Engine application?

Due to the architecture of our App Engine application we can't use the App Engine cron service that Google provides and are looking for alternative options.

One possible solution we have come up with is to allow our App Engine PHP application to automatically create a cronjob on a compute engine instance. This instance would simply be a utility machine which would handle nothing but the cron jobs.

How would we create the crons in compute engine from within the App Engine application using PHP?

like image 332
Ketan Mistry Avatar asked Oct 28 '25 03:10

Ketan Mistry


1 Answers

Because your google cloud instances can go down or up at any minute, (And also, you may have multiple instances of the same app running), which would make cron unreliable as it may trigger multiple times across multiple machines, google has created Task Scheduling, which is available on Google Compute Engine.

A great tutorial can be found here, and a sample can be found here.

For a PHP specific implementation of pub/sub, see this link.

like image 117
ugh StackExchange Avatar answered Oct 29 '25 20:10

ugh StackExchange



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!