Cron job syntax

1 view
Skip to first unread message

GAEfan

unread,
Nov 17, 2009, 8:39:19 PM11/17/09
to Google App Engine
Is it possible to specify various times in a Cron schedule, like:

- description: do this job
url: /atThisURL
schedule: every mon,tue,wed,thu,fri,sat
06:00,07:00,08:00,09:00,10:00,13:00,17:00

From the spec, it does not look like you can. Hate to waste 7 cron
jobs on this one task.

Thanks.

Sylvain

unread,
Nov 18, 2009, 5:06:49 AM11/18/09
to Google App Engine
Else you can run the job each hour and check the time in your code.

Regards.

Eli Jones

unread,
Nov 18, 2009, 10:54:47 AM11/18/09
to google-a...@googlegroups.com
Here's the fun way!

Figure out a way to represent the sequence of hours you need it to run... n0 = 6, n1 = n0 + 1, n2 = n1 + 1,  n3 = n2 + 1, n4 = n3 + 1, n5 = n4 + 3, n6 = n5 + 4

Have a cron job start it off at 6am... Then have the code set a taskqueue to call itself.. Setting k = k+1 as a parameter each time until it gets to k = 6.

I think u could use a = 1 + floor(k/5)*(k-3)

So.. You'd have:
n[0] = 6 and n[k] = k + a

Which.. if you start at 6AM, will then run at 7,8,9,10,13,17

Thus.. At the end of the k-th run.. You just fire off a taskqueu to call the url again with delay = a and params = {'k' : k+1}

When the task url is sent the put request.. it checks if k<6 or whatever.. if it is.. then the rest of the task runs.

kind of cheesy.. but fun to think about. :)


--

You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=.



Reply all
Reply to author
Forward
0 new messages