How to use cron scheduling in drone 1.0.0-rc.1

Please tell me the format of the parameter “Cron Job Expression”.
I set it to “1 * * * *” but the build is not run per 1 minute.

The cron schedule is not meant to be accurate to-the-minute. The minimum execution time is schedule to every 30 minutes by default, although you can reduce this time using the DRONE_CRON_INTERVAL environment variable.

You can read more about the cron parser and syntax here: https://godoc.org/github.com/robfig/cron

Note that the cron parser we are using requires that you provide the seconds (missing in your example) so hourly would be expressed as 0 0 * * * * or @hourly. It is likely in the final 1.0 release we will only support @hourly, @daily, @weekly and @monthly.

Thank you for your reply.
I set “Cron Job Expression” to “@hourly” and builds were run at about 10:22 AM JST and 11:22 AM JST.

  1. So do repositories whose “Cron Job Expression” are same are run at the same time?
  2. For example, is it difficult to run build about 10:00 AM daily?

The drone server container seemed to run at 2018-11-16T06:21:17.498971985Z .

$ docker inspect drone-server
StartedAt": "2018-11-16T06:21:17.498971985Z"

So the time cron job are run seems to depend on the time drone server run.

The cron runner is not meant to be accurate. It runs all pending jobs in batch, every 30 minutes by default, which is the reason you are seeing this behavior.

This means that if your server starts at 10:20, it will run pending cron jobs at 10:50 and 11:20. If the hourly job was scheduled to run at 11am it will not execute until 11:20.

The interval in which cron jobs are executed in batch can be adjusted, which can result in increased accuracy. For example, you can set DRONE_CRON_INTERVAL=1m, which instructs drone to process pending cron jobs every minute, instead of the default 30 minutes.

Thank you for your detailed explanation!
I can understand perfectly.

Thank you again.

i have just started with drone
@bradrydzewski suppose i run a server around 10:00 Am and at that time .I didn’t add any cron jobs. but after few hours i add a cron job (let say at 11:30 AM) on @hourly basis. so when will it gonna run my pending jobs . will it run any job even if i don’t have any pending jobs .
as you have mention in this blog that i can schedule my build s
https://blog.drone.io/drone-1/ as you have mention in this blog about cron jobs schedule
so i am adding cron jobs as my latest build name and set it hourly so it will re run that build after an hour ??