Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In a cron expression, what is the difference between 0/1, 1/1 and * ?

share|improve this question
    
The / is stepping, explained really well here: publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/… –  NickW Mar 19 at 12:36
1  
Why the down vote, please? Any missing information? Does the question belong to another stackexchange site? –  fiddler Mar 19 at 12:47
    
Mouse over the down arrow; the popup says "This question does not show any research effort; it is unclear or not useful". Downvotes without comment may be presumed to be for at least one of those reasons - though I note the downvoter has since retracted. –  MadHatter Mar 19 at 14:33
    
Thanks @MadHatter, I just don't have enough reputation yet to see the vote details –  fiddler Mar 19 at 15:55

3 Answers 3

up vote 10 down vote accepted

It depends on where the terms are located

  • 0/1 means starting at 0 every 1.
  • 1/1 means starting at 1 every 1.
  • * means all possible values.

so

  • For the minutes, hours, and day of week columns the 0/1 and * are equivalent as these are 0 based.

  • For the Day Of Month and Month columns 1/1 and * are equivalent as these are 1 based.

share|improve this answer
    
Very clear answer. Thank you. –  fiddler Mar 19 at 12:55

In crontab definition, the meaning of the five date/time fields are :

  1. At which minutes of the hour (so from 0 to 59)
  2. At which hour of the day (so from 0 to 23)
  3. At which day of the month (so from 1 to 31)
  4. At which month of the year (so from 1 to 12 or names - Jan, Feb, ...)
  5. At which day of the week (so from 0 to 6 or names - Sun, Mon, ...)

A * means from the first to the last element of the range. A n/x means starting at n, at every x values.

In your case, this can be translated by :

  1. At minutes 0
  2. Starting at midnight, every hour (which is similar to *)
  3. Each day of the month
  4. Starting the first month (January), every month (which is similar to *)
  5. Each day of the week (for the first *)

The end looks incorrect (? *) as it is in the place of the command. Or in the place of the username & command if taken from a file under /etc/cron.d/ and not from the crontab of a specific user.

share|improve this answer

The 0/1 means every 1 min or every mintue and 1/1 means evey month i think,but i m not sure it will work that way for month.

share|improve this answer
    
Then what is the difference between 0/1, 1/1 and * ? –  fiddler Mar 19 at 12:38
    
The 0/1 is in the hour position. –  Iain Mar 19 at 12:42
    
that one is for hour –  vic Mar 19 at 12:42
    
Sure, but can I replace the hour part 0/1 by 1/1 for instance ? Will it mean the same? –  fiddler Mar 19 at 12:45
    
Isn't the same as putting 0 or 1 then ? –  fiddler Mar 19 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.