Cron expression to run job twice a day at different time?

后端 未结 3 1265
时光取名叫无心
时光取名叫无心 2021-01-12 01:41

I have one job that needs to be execute twice a day at different time . e.g. 10:00 and 15:30. How can i achieve this ?

I am confuse because minute is different for b

相关标签:
3条回答
  • 2021-01-12 02:18

    You can set values for each job:

    0 10 * * * job
    
    30 15 * * * job
    

    Here is more info:

    *    *    *    *    *  command to be executed
    ┬    ┬    ┬    ┬    ┬
    │    │    │    │    │
    │    │    │    │    │
    │    │    │    │    └───── day of week (0 - 7) (0 or 7 are Sunday, or    use names)
    │    │    │    └────────── month (1 - 12)
    │    │    └─────────────── day of month (1 - 31)
    │    └──────────────────── hour (0 - 23)
    └───────────────────────── min (0 - 59)
    

    Wikipage about cron https://en.wikipedia.org/wiki/Cron

    0 讨论(0)
  • 2021-01-12 02:26

    I have tried using 0 1,6 * * ? * expression for my request - to schedule job during 1am and 6am every day. So for your request to schedule 10:00 and 15:00 time, i believe the following cron expression should work. Please give a try and let me know 0 10,15 * * ? *

    0 讨论(0)
  • 2021-01-12 02:30

    Try following which you will get closest in one expression

    0 0 10,15/12 * * ?
    

    this will run 10:00 and 15:00.

    0 讨论(0)
提交回复
热议问题