aspose file tools*
The moose likes Linux / UNIX and the fly likes Cron expression issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Cron expression issue" Watch "Cron expression issue" New topic
Author

Cron expression issue

Amol Fuke
Ranch Hand

Joined: Apr 08, 2005
Posts: 129
Hi ,

I have a cron job scheduled to run at every hour ;



Suppose I have created another job at 3:38 PM, will it run at 4 PM/5 PM/6 PM or 4:38 PM/5:38 PM/6:38 PM ?

Another question , what would be the cron expression if I want to run the job every hours in besiness hours i.e. between 7 AM to 7 PM.

is this right "0 0 7-19 ? * *" .But sometimes the jobs gets fired after 19 hours also.

Please let me know.

Thanks,
Amol


"There are no mistakes, only lessons"
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

You might get more responses in the Linux forum, moving.


JBoss In Action
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Peter Johnson wrote:You might get more responses in the Linux forum, moving.

Not sure this is a unix cron here. I don't think that unix cron has a setting for seconds. It should have only 5 fields, not 6.

Amol, where are you setting this expression ?


[My Blog]
All roads lead to JavaRanch
Justin Yao
Greenhorn

Joined: Jun 16, 2006
Posts: 19
Amol Fuke wrote:Hi ,

I have a cron job scheduled to run at every hour ;



Suppose I have created another job at 3:38 PM, will it run at 4 PM/5 PM/6 PM or 4:38 PM/5:38 PM/6:38 PM ?

Another question , what would be the cron expression if I want to run the job every hours in besiness hours i.e. between 7 AM to 7 PM.

is this right "0 0 7-19 ? * *" .But sometimes the jobs gets fired after 19 hours also.

Please let me know.

Thanks,
Amol



The fields of crontab expression
minutes hours day_of_month month day_of_week


If I want to run the job every hours in besiness hours, should be like this
0 9-18 * * 1-5
it will run every hour between 9AM to 6 PM from Monday to Friday
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cron expression issue