How to schedule code execution?

I am working on a web application where I need to schedule some code. For this I use quartz. Now the problem is that I want her to work every day or talk 24 hours. Please let me know how to do this. I have not done this before, and I am using sample code from the scheduler API.

+3
source share
3 answers

The question has been asked too long.

Please edit the code block something like this in your scheduler code. and add this line as the last parameter.

"0 0 12 * *?"

Fire at 12 noon (noon) every day

Please use the link for more help.

+6

, , , Quartz crontab , ( - ).

  • crontab 5 Quartz 6 7 ( - ).
  • 1-indexed Quartz 0-indexed crontab.
  • .

:

Field Name     Mandatory?  Allowed Values    Allowed Special Characters
Seconds        YES         0-59              , - * /
Minutes        YES         0-59              , - * /
Hours          YES         0-23              , - * /
Day of month   YES         1-31              , - * ? / L W
Month          YES         1-12 or JAN-DEC   , - * /
Day of week    YES         1-7 or SUN-SAT    , - * ? / L #
Year           NO          empty, 1970-2099  , - * /

Crontab:

crontab , , , .

*     *     *     *     *  command to be executed
-     -     -     -     -
|     |     |     |     |
|     |     |     |     +----- day of week (0 - 6) (Sunday=0)
|     |     |     +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
+5

Use online services such as Scheduler.CodeEffects.com if you can post your code online (or access it through a web page, for example). Code effects give one schedule for free.

+1
source

Source: https://habr.com/ru/post/1714754/


All Articles