function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gaurav AgnihotriGaurav Agnihotri 

Schedule an hourly batch job in the middle of an hour

Guys, 
I have scheduled an hourly batch job. I want the job to start at 30 minutes instead of the begining of an hour. I was wondering how can I acomplish it.
Below is the code:
String CRON_EXP1 = '0 0 * * * ?';
ScheduleBatchWarehouseUpdate schU = new ScheduleBatchWarehouseUpdate();
system.schedule('Hourly  Warehouse Update', CRON_EXP1, schU);

 
Gaurav AgnihotriGaurav Agnihotri
Would it work if I change the  CON_EXP1 to '0 30 * * * ?';
Marc D BehrMarc D Behr
Yes, that should do it... sort of. When you request that a batch job be run on Salesforce, you are basically telling the system how often you want things run. The actual start time will be whenever the system pulls your job off the queue as it gets time. So you can request that it runs at 30 minutes past every hour, but it may run at 12:30, then 1:33, then 2:45, then 3:35, etc. You can't depend on the job running exactly at the 30 minite mark. It could be delayed quite a bit if things are busy.