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
Megha Mittal 19Megha Mittal 19 

I have scheduled an apex job to run every hour. Its not running but showing the next scheduled run in a past time

PawanKumarPawanKumar
Hi Megha,

Please try below script and CRON expression.

The following will create a Schedule to run every hour, starting on the next hour from submission.

System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );


Given this, create a scheduled class that can be scheduled on the day you need.

public with sharing class MyScheduleStart implements Schedulable
{
    public void execute(SchedulableContext ctx) 
    {
        System.schedule('Hourly', '0 0 * * * ?', new MyHourlySchedule() );  
    }
}

Please mark it best if it helps you. Thanks.
Megha Mittal 19Megha Mittal 19
Hi Pavan,

I have done the same already. 
The job is schdeuled but its not running on the time it was schduled to run. In the apex jobs the scheduler is queued but the batch class this schdeuler is supposed to call is not running. The next run time is a past time. 

Regards,
Megha
PawanKumarPawanKumar
Please share your code for further analysis.