Any job that is scheduled in the salesforce will be registered or CronTrigger object (which is available from version 17 and later).
If you want to know the status of the job, we can write a SOQL on CronTrigger object using jobid generated by system.schedule( ) method invocation.
cronTrigger cron = [select id,cronExpression from cronTrigger where id =: jobId];
cronTrigger ct = [select TimesTriggered , Nextfiretime from cronTrigger where id =: jobId];
Fields in CRON Trigger:
- CronExpression : Used to initiate the Schedule.
- CronJobDetail : ID of the Cron Job Detail record containing more details about this Scheduled job.
- EndTime : The date and time when the job either finished or with finish.
- NextFierTime : The next date and time the job is scheduled to run null if the job is not scheduled to run again.
- OwnerID : Owner of the job.
- PreviousFireTime : The Most recent date and time the job run . null if the job has not run before current local time.
- StartTime : The date and time when the most recent iteration of Scheduled job started.
- State : Current start of job (Waiting, Acquired, complete…) .
- TimeTriggered : The number of times this job has been triggered .
- TimeZonesIdKey : Returns the time Zone ID .