简体   繁体   中英

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!

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM