• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

cron job schedule change

 
Ranch Hand
Posts: 1019
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have cron job running daily at 8 am in my spring boot java micro service like below



app.scheduler.memberPlanExecution-DailyRun: '0 0 8 * * *'





Cron expression generator - Quartz
Use this online user interface to generate cron expressions based on the Quartz engine.

Seconds
Minutes
Hours
Day
Month
Year
Every second
Every  123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960  second(s) starting at second  000102030405060708091011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
Specific second (choose one or many) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59






I like to run at 8 AM, 1 PM, 4 PM, 6 PM daily. Instead of one tiome at 8 three more times during the day.

How to change my cron expression something like below?

app.scheduler.memberPlanExecution-DailyRun: '0 0 8/13/16/18 * * *'

or like below

app.scheduler.memberPlanExecution-DailyRun: '0 0 8^13^16^18 * * *'

or something else?

Please advise
 
Saloon Keeper
Posts: 28713
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should be:

0 0 8,13,16,18 * * *
 
sai rama krishna
Ranch Hand
Posts: 1019
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the guidance. None of online documentation I could find this example in my search though. Everywhere they are examples of fixed intervals
 
Tim Holloway
Saloon Keeper
Posts: 28713
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The secret is to look up help on the cron command itself (crontab).  https://linux.die.net/man/5/crontab
 
sai rama krishna
Ranch Hand
Posts: 1019
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That make lot of sense. Always better to go to source first
 
sai rama krishna
Ranch Hand
Posts: 1019
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to change as below  8 AM, 1 PM, 4:30 PM, 6 PM daily.

Hope It should work as below right with : in between? Please advise


0 0 8,13,16:30,18 * * *
 
Tim Holloway
Saloon Keeper
Posts: 28713
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have never seen such a construct. As far as I know, only simple integers (or day names) are valid as data points in a cron entry.

However, you should be able to simply add a second cron schedule for the off-time job. Like so:

Multiple cron schedules are a basic feature; the system cron often manages many unrelated jobs, each on their own schedule.
 
sai rama krishna
Ranch Hand
Posts: 1019
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I suggested to take int number rather than decimal number due to this challenge
 
reply
    Bookmark Topic Watch Topic
  • New Topic