Installing and upgrading
Backups
Security
User management
Advanced user group options
Customising ResourceSpace
Plugins
StaticSync
Configuring ResourceSpace
Integrations

Offline job queues

The purpose of the offline jobs function is to delegate slow processes, such as creating a preview for a video file, to another script/process to be run asynchronously. The upload process therefore focuses on getting files into the filestore, later working from a queue for further processing.

Originally developed to work alongside the Video tracks plugin, job queue functionality has been expanded to allow the following to be handled offline:

  • Creating an alternative file from the specified command
  • Running a command that will create an output file, optionally specifying a download URL that can be sent to the user
  • Creating previews for resources or alternative files1
  • Downloading collections of resources2
  • Deleting files
  • Extracting text from the resource and saving to a configured metadata field

1 Some previews will still be created at upload - refer to Minimal preview creation

2 Please note that the offline jobs functionality for collection downloads is not available when ResourceSpace is accessed anonymously or via an externally shared collection

Offline jobs cannot be run individually by a user, they are run in the command line, usually using a regular cron job.

To enable this perform the following steps:-

  1. Enable a scheduled task (Windows) or cron job (Linux) that runs /pages/tools/offline_jobs.php as frequently as desired e.g.
    */5 * * * * cd /var/www/pages/tools; php offline_jobs.php 
    
  2. Set the following option in the ResourceSpace configuration file (config.php)
    $offline_job_queue=true;

The offline_jobs.php script can accept additional parameters as per the script help text output below (from running php offline_jobs.php --help). The --max-jobs can be useful to prevent many instances of the script from slowing a server down e.g. if a large amount of previews are being regenerated

SYNOPSIS
    php /path/to/pages/tools/tools/offline_jobs.php [OPTIONS...]

DESCRIPTION
    Used to run ResourceSpace offline jobs. Normally trigggered by a cron entry/scheduled task.

OPTIONS SUMMARY

    -h, --help          Display this help text and exit
    -j, --job           Specify the job ID to run
    -c, --clear-lock    Clear any existing process locks for jobs
    -m, --max-jobs      Maximum number of concurrent jobs that can be running (integer)

EXAMPLES
    php offline_jobs.php --clear-lock --job 256 
    php offline_jobs.php --max-jobs 5