Closed rmordillo-witbooking closed 8 years ago
Have you tried @Scheduled(cron = "0 0 */4 * * *")
as your expression for every 4 hours?
In the future, use markdown code fences to make things easier to read.
Hi, I edited my post is fenced now , also edited the comment in java. It is supposed to be running every 4 hours. What I meant is that , for instance:
Job1 is launched Job1 is COMPLETED Just after this Job1 is launched again , and again
the same goes for the other 2 jobs.
Sorry I didn't explain it like this before.
My suggestion is to alter your cron expression and use 0's in place of *'s as shown in the my comment.
oh! sorry Let me try it this way then althought I thought * were used as a "any". I will keep you posted about it. thanks
Well, * (in any programming context) means any. You are saying "any second, any minute", which kind of undermines trying to ONLY hit every x hours. But "0 0 */4" is like "on the 0th second and the 0th minute, and any hour divisible by 4, then go". If you have a whole slew of cron jobs that happen every 4 hours, it gives you the power to stagger them to different
4:00:00, 4:00:01, 4:00:02, 4:00:03, ... 4:01:00, 4:01:01, etc. would qualify if you used *'s like that.
Hi! it seems that I understood or misread some tutorial about this topic. You were right, and now it works as I expected.
Thanks for your help
I have some issues with this Jobs triggering from multiple instances of the Pivotal Cloud. How to prevent this. Any suggestions??
Hi!
I have scheduled 3 jobs :
And added @enableScheduling in my Spring boot's Application.java.
The thing is that the jobs run multiple times even after the first execution finishes with COMPLETED.
I don't know if this is due to some misconfiguration but can't fix it.
Any thoughts?
thanks in advance