Jamal Martin
Jamal Martin

Reputation: 85

Seting up a cron job in google app engine

I went to Google's site on cron's and it looks like I can not set a cron job to run Mon-Fri every 10min from 07:00 to 15:00. Therefore I have 2 questions:

1) Can I have the cron job run every day, then have it not run on Sat and Sun, and then resume again on Mon-Fri?

2) If I can't do the first option, is there a way to have a cron job quit automatically?

Im am doing this in Python. If this isn't possible, is there a page I can look to for help?

Upvotes: 4

Views: 587

Answers (2)

voscausa
voscausa

Reputation: 11706

A somewhat cheaper alternative. Run the CRON: every monday, tuesday, wednesday, thrursday, friday at 07:00 This weekday CRON starts a task (deferred or push), which will schedule a next task in 10 minutes until 15:00.

Upvotes: 0

RocketDonkey
RocketDonkey

Reputation: 37279

Since you lose the ability to specify ranges once you specify days, I think the best option would be to supply the time (every 10 minutes from 07:00 to 15:00) and then have a check in your script itself that checks the current date to determine if it is a weekday or not. You could do that with something simple like :

>>> import datetime
>>> today = datetime.datetime.today()
>>> today.weekday()
1

Where 0 = Monday, 1 = Tuesday, etc. If your cron verified that the current weekday was in (5, 6), then you could simply exit your program. One way of structuring this could be to link your cron to a simple function that checked the day - if a weekday, then your main function is called; if not, it ends. There may be a better way, but that's the best I can come up with right now :)

Upvotes: 4

Related Questions