开发者

how to make a special cron job?

开发者 https://www.devze.com 2023-01-10 16:31 出处:网络
i need to make a cron job to开发者_JAVA百科 run a java program every 40 minutes on unix server. considering that: 1)it should run from 8h30 to 12h30 and from 14h to 18h from monday to friday 2) take c

i need to make a cron job to开发者_JAVA百科 run a java program every 40 minutes on unix server. considering that: 1)it should run from 8h30 to 12h30 and from 14h to 18h from monday to friday 2) take consideration of holidays.

i've read a lot about it and found this */30 8..13,14..19 * * 1..5 as the closest solution. i wanna know if crontab can do what i want, and if not is Quartz capable of doing so?

thanks for your help


When faced with complex timing such as this, it is often better to simply launch the job using the basic pattern. The program itself can terminate immediately if any of the "exception" cases (holidays) are true. As far as dealing with holidays, I recommend keeping a data file with the days that are exceptional so it can be updated if the client's paid days off change.

If you can not modify the Java of the target program, have the cron job launch a small program that does the verification step and then launches the actual target program as long as none of the exceptional cases are true.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号