job schedule skip a job In job schedule module, I have bunch of jobs that works, What I want to do is give the admin the ability to stop a certain job as he desires.

The only way I could do is that I could remove the job all together from the table with this:


  JobScheduler::get($job['name'])->remove($job);


and I would recreate it again.

But isnt there a way to skip the job instead of deleting and recreating it again? Rules maybe?
I ended up deleting the job and recreating it again.

here is how just incase.


// job_id = the job id in job_schedule table.
// $import_status = weather we want to delete or create a job.
// $importer_type = I had 2 types of importers to switch between.
// $original value = only recreating a job if it was deleted first.

function schedule_conrtol($job_id, $import_status, $importer_type, $original_value) {
  if ($import_status === 1) {
    // Deleting a job
    $job = array('name' => 'job_name',
                 'type' => $importer_type,
                 'id'   => $job_id
                );
    JobScheduler::get($job['name'])->remove($job);
  }

if ($import_status === 0 &amp;&amp; $original_value === "1") {
    // Inserting a job
    $job = array(
    'name'     => 'job_name',
    'type'     => $importer_type,
    'id'       => $job_id,
    'period'   => 1800,
    'periodic' => TRUE,
    );
    JobScheduler::get($job['name'])->set($job);
  }

}


and you can control this using hook_node_presave

hope this helps.