Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schedule a Firebase Cloud Function to run every 30 minutes at the start of every hour and then 30 minutes later

I saw that Firebase recently launched a way to schedule Cloud Function at regular intervals. I have been using an online crob job scheduler and currently migrating those jobs over to Firebase Cloud Function. I want to run the Cloud Function every 30 minutes at the start of every hour and then 30 minutes. So, say I deploy the function at 1:45 PM. Then the Cloud Function should run at 2:00 PM, 2:30 PM, 3:00 PM and so on.

I tried using the schedule('every 30 minutes') but this runs the Cloud Function after 30 minutes from the time it is deployed.

Is there a way to specify the schedule such that it runs as described above?

like image 269
Varun Gupta Avatar asked Jun 05 '19 17:06

Varun Gupta


1 Answers

this should work like charm.

export myCronFn =
functions.pubsub.schedule('0,30 0-23 * * *').onRun((context) => {
    //
})

source: https://crontab.guru/#0,30_0-23___*

like image 190
andresmijares Avatar answered Nov 15 '22 08:11

andresmijares