You need to sign in to do that
Don't have an account?
Waqar Hussain SF
how to run batch class every hour? here is my schedulable class. my class doesn't run after every hour. I have to run through the developer console.
global with sharing class SchedularForBatchApex implements Schedulable {
global void execute(SchedulableContext sc) {
myBatchClass d = new myBatchClass();
database.executebatch(d, 10);
}
Public static void SchedulerMethod(){
SchedularForBatchApex s = new SchedularForBatchApex();
string con_exp= '0 0 * * * ?';
System.schedule('myBatchClass', con_exp, s);
}
}
global void execute(SchedulableContext sc) {
myBatchClass d = new myBatchClass();
database.executebatch(d, 10);
}
Public static void SchedulerMethod(){
SchedularForBatchApex s = new SchedularForBatchApex();
string con_exp= '0 0 * * * ?';
System.schedule('myBatchClass', con_exp, s);
}
}
String con_exp = '0 0 1 * * ?';
I think this expression run everyday at 1 A.M.
Am I right or wrong?
All Answers
It looks like you have defined wrong expression for schedule at every one hour.
Correct: '0 0 1 * * ?'
Replace "SchedulerMethod":
Thanks & Cheers,
Jigar
String con_exp = '0 0 1 * * ?';
I think this expression run everyday at 1 A.M.
Am I right or wrong?
But your expression is correct as per the, Second, Minute, Hour....(0 0 * * * ?);
Then I am not sure whay it is not wokring.
Can you try with - '0 59 * * * ?'. if it works.
Thanks & Cheers,
Jigar
String s1='0 05 * * * ? 2014';
System.schedule('<Nameof the schedule job>',s1,<u r object>);