I have a batch and now I want to create a schedulable class to run the batch every Saturday at 1AM. I was following the salesforce docs but cannot seem to grasp everything correctly.
Here's my schedulable class code
global class SchedulableClass implements Schedulable {
global void execute(SchedulableContext sc) {
IndependentBatch b = new IndependentBatch();
database.executebatch(b);
}
SchedulableClass saturday1am = new SchedulableClass();
String sch = '0 0 01 ? * 7';
String jobId = system.schedule('sat1am', sch, saturday1am);
}
How do I activate this class? Is my syntax correct? Am I supposed to move the string sch and system.schedule inside the execute? If so do I remove the database.executebatch(b) in this case?