batch for every 2 min? I though that you can only run a batch, minimum, every hour. This is one hour: - ', '0 0 0/1 * * ?' - right? What would be the 2 minutes? Could you please let me know? Thanks
I am not talking about Max. No. of Batches in a day which is 2000.I am talking No. of scheduled Jobs which is 25 in an org because the Apex Jobs needs to be scheduled as well.
System.schedule('Job9', '0 2 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job3', '0 4 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job4', '0 6 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job5', '0 8 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job6', '0 10 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job7', '0 12 * * * ?', new BatchApex('gggggg', '0019000000LRvuw')); System.schedule('Job8', '0 14 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));.....................30 times
You can't schedule it this way,it would hit the limit of No. of scheduled Jobs.
Finally the preferred solution will be as followed.
Schedule the same batch 20 times in an hour as followed
System.schedule('Job9', '0 3 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job3', '0 6 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job4', '0 9 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job5', '0 12 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job6', '0 15 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job7', '0 18 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job8', '0 21 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));.....................20 times
By this your batch will run once in every 3 mins.
All Answers
files/records?
Attachments.
You can run a batch for every 2 min and you can delete the Attachment records.
This is one hour: - ', '0 0 0/1 * * ?' - right?
What would be the 2 minutes? Could you please let me know?
Thanks
This needs some work around as followed.
Schedule the same batch 30 times in an hour as followed
System.schedule('Job9', '0 2 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job3', '0 4 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job4', '0 6 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job5', '0 8 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job6', '0 10 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job7', '0 12 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job8', '0 14 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));.....................30 times
By this your batch will run once in every 2 mins.
Harsha,
This is going to hit the governor limit of salesforce as the maximum no. of scheduled Jobs is limited.
Max limit per day is 2000, but in our case we are just calling it for 1440 times in a day.
Assuming no other batches are running.
Harsha.
I am not talking about Max. No. of Batches in a day which is 2000.I am talking No. of scheduled Jobs which is 25 in an org because the Apex Jobs needs to be scheduled as well.
System.schedule('Job9', '0 2 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job3', '0 4 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job4', '0 6 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job5', '0 8 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job6', '0 10 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job7', '0 12 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job8', '0 14 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));.....................30 times
You can't schedule it this way,it would hit the limit of No. of scheduled Jobs.
Ohh, yes
Then we can make 20 batches, with each batch running for the interval of 3 min.
Right?
Yes it could be done depending there are no more other scheduled classes in the org.I mean the total should not exceed 25.
Finally the preferred solution will be as followed.
Schedule the same batch 20 times in an hour as followed
System.schedule('Job9', '0 3 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job3', '0 6 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job4', '0 9 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job5', '0 12 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job6', '0 15 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job7', '0 18 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));
System.schedule('Job8', '0 21 * * * ?', new BatchApex('gggggg', '0019000000LRvuw'));.....................20 times
By this your batch will run once in every 3 mins.