Significance of question mark in Java cron

Source Wikipedia:

Question mark (?) is used instead of '*' for leaving either day-of-month or day-of-week blank.

The above statement is not making much sense to me.

So if I write some cron as 0 0 0 ? * * then does it mean first of every month or it means it will execute daily?

It is a bit confusing as Java crons start with seconds while other crons start with minute.

Answers


I am not Cron expert

But according www.cronmaker.com it is executed daily.


According to the Quartz CronTrigger tutorial (Quartz is used by www.cronmaker.com, referenced above), the ? wildcard is only used in the day of month and day of week fields:

? ("no specific value") - useful when you need to specify something in one of the two fields in which the character is allowed, but not the other. For example, if I want my trigger to fire on a particular day of the month (say, the 10th), but don't care what day of the week that happens to be, I would put "10" in the day-of-month field, and "?" in the day-of-week field.

I guess * isn't appropriate here because * means execute on every day of the week, which contradicts the rule saying that it should only run on the 10th of the month.


I know it's an old question but for posterity, it's explained here : http://www.nncron.ru/help/EN/working/cron-format.htm#STARTTIME

Both in classic and extended modes, nnCron users can use a "nonstandard" character "?" in the first four fields of cron format. It stands for time of nnCron startup, i. e. when a field is processed, startup time will be substituted for the question mark: minutes for Minute field, hour for Hour field, day of the month for Day of month field and month for Month field.

For example, if you write the following:

Time: ? ? * * * * the task will be executed on nnCron startup and then will be executed daily at the same time (unless the user doesn't restart nnCron, of course): question marks will be "replaced" by nnCron startup time. For example, if nnCron was started at 8:25, question marks will be substituted this way:

Time: 25 8 * * * *


Need Your Help

Animated loading gif with iframes loads

javascript jquery iframe loading

I have this little script which displays a loading animated gif (throbber wheel) whilst my iframe is loading and then disappears when it fully loads:

How do I index rich-format documents contained as database BLOBs with Solr 4.0+?

database solr blob apache-tika solr-cell

I've found a few related solutions to this problem. The related solutions will not work for me as I'll explain. (I'm using Solr 4.0 and indexing data stored in an Oracle 11g database.)