Documentation

Sometimes a job gets left in a running state, so preventing the job from being run again. This could happen because:

  • There is a fault in the job
  • The job runs past server limits
  • A network failure
  • Something totally random

Jobs Job re-enables jobs left in a running state. It can be configured through a config/site parameter to:

  • Enable all jobs
  • Enable  specific jobs
  • Exclude specific jobs

By default, Jobs Job will re-enable any job it finds in the 'RUNNING' state:

define('JOBS_JOB_REENABLE', 'all');

The parameter takes a comma separated list of tokens that are interpreted in sequence to control how Jobs Job processes the state of jobs. The last action relating to any particular job is the action that is finally applied:

Relating to all jobs:

  • all - (default) - puts any jobs found in the RUNNING state into the ENABLED state.
  • +all - puts all jobs into the ENABLED state no matter what.
  • -all - removes all jobs from consideration.
  • stomp - as per '+all'.

To put a specific job into the ENABLED state, but only if it is found in the RUNNING state.

  • jID - a job ID number.
  • jHandle - a job handle as a string.

To put a specific job into the ENABLED state no matter what.

  • +jID - a job ID number.
  • +jHandle - a job handle as a string.

To exclude a job from re-enable processing.

  • -jID - a job ID number.
  • -jHandle - a job handle as a string.

To control logging of outcomes

  • log - Log actions that conditionally set something RUNNING.
  • +log - Log actions that set something RUNNING.
  • -log - (default) - do not log anything.

Example 1:

define('JOBS_JOB_REENABLE','all,-1,-jl_jobs_job,+jl_backup_job');

Would start with a list of all jobs to be conditionally re-enabled, then remove the job with ID number 1 from the list, then remove this job from the list, then make sure that jHandle jl_backup_job was always enabled.

Example 2:

define('JOBS_JOB_REENABLE','index_search,generate_sitemap,log');

Would re-enable the Search Index job and the Site Map job if it found them in the RUNNING state and make a note of doing so in the log.

Jobs Job can also be configured from the job url as the parameter 'actions' or the list of parameters 'actions[]'. If using url parameters, some characters such as '+' will need to be url escaped.

WARNING - A job may be stuck in a running state for a very good reason - there could be a serious issue with that job. Indiscriminately re-enabling such a job will not cure the issue.

To run Jobs Job at set stimes, use cron or FlexJob Scheduler.