0

I'm looking at a system where someone added a cronjob which schedule is like this:

0 1/12 * * * doSomething

More commonly, if the hours part in the schedule were */12 then it would execute every 12 hours.

What would be the expected behaviour of 1/12?

Running Ubuntu version 12.04

2 Answers 2

0

The other answer suggest this syntax indicates increments. Now I've set up a test with this expression 1/12 on the minutes field:

1/12 * * * * date >> ~/crontest.tmp

If it would increment, then it would run on these minutes of every hour: 1, 13, 25, 37 and 49. But the results so far are:

Mon Aug 24 17:01:01 CEST 2015
Mon Aug 24 18:01:01 CEST 2015
Mon Aug 24 19:01:01 CEST 2015
Mon Aug 24 20:01:01 CEST 2015
Mon Aug 24 21:01:01 CEST 2015
Mon Aug 24 22:01:01 CEST 2015
Mon Aug 24 23:01:01 CEST 2015
Tue Aug 25 00:01:01 CEST 2015
Tue Aug 25 01:01:01 CEST 2015
Tue Aug 25 02:01:01 CEST 2015
Tue Aug 25 03:01:01 CEST 2015
Tue Aug 25 04:01:01 CEST 2015
Tue Aug 25 05:01:01 CEST 2015
Tue Aug 25 06:01:01 CEST 2015
Tue Aug 25 07:01:01 CEST 2015
Tue Aug 25 08:01:01 CEST 2015
Tue Aug 25 09:01:01 CEST 2015

If you'd use an expression like */12 then it would run on "every minute that is divisible by 12": 12, 24, 36, 48 (0 or 60 included?)

So my guess would be that 1/12 would be "every 1st minute of every hour that is divisible by 12", which is never, so it will fall back to "every 1st minute of every hour".

And thus 1/12 in the hours field would run every day at 01:00 AM.

0

What would be the expected behaviour of 1/12?

0 1/12 * * * doSomething

This means run at 1 am and then every 12 hours (1,13,...).


Special characters

/ - used to specify increments.

For example, 0/15 in the seconds field means "the seconds 0, 15, 30, and 45". And 5/15 in the seconds field means "the seconds 5, 20, 35, and 50".

Source CronTrigger Tutorial

3
  • CronTrigger link is broken
    – 7ochem
    Dec 9, 2016 at 12:10
  • @7ochem Thanks. I have updated the link.
    – DavidPostill
    Dec 9, 2016 at 12:12
  • I think your explanation is specific for the Quartz Job Scheduler. See my own answer with test results on Ubuntu 12.04
    – 7ochem
    Dec 9, 2016 at 12:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .