misterdh
misterdh

Reputation: 83

How to pass arguments on cron in Google App Engine?

I am trying to run a cron job in Google App Engine with a parameter but cannot send any parameters in cron.yaml. Anyone know how to send parameters in cron.yaml?

handlers:
- url: /testing
  script: testing.php

What I want to send is testing.php?testing=12345, but the script won't run if I write it like that.

I read this:

How to pass arguments to a python cron task on Google App Engine?

.. but I didnt understand much of it as it was for Python.

Thanks!

Upvotes: 2

Views: 2258

Answers (1)

David Long
David Long

Reputation: 191

cron: - description: Testing Cron url: /testing.php?testing=12345 schedule: every 60 mins

According to Google ( https://developers.google.com/appengine/docs/php/config/cron ) the above should be the correct syntax, note the use of cron instead of handlers.

I'd like to know why you are using a query string parameter? If this is to restrict access you could easily do this by adding admin login only:

cron: - description: Testing Cron url: /testing.php?testing=12345 schedule: every 60 mins login: admin

Alternatively if you are convinced that adding a query string to the end of your url is not working you can always use different urls for differing tasks...

Upvotes: 5

Related Questions