|MediaWiki file: runJobs.php
|master • 1.41.0 • 1.40.2 • 1.39.6
maintenance/run.php. Invoking maintenance scripts directly will trigger a warning.
runJobs.php file is a maintenance script to manually force the job queue to run. Under normal circumstances jobs in the queue are run as a function of user interaction with the wiki (ordinary apache requests). The default rate jobs are run is 1 to 1 and can be changed by adjusting $wgJobRunRate in the LocalSettings.php file. Note that the default memory limit for a job is 150 MB so that a bad job does not consume all the server's memory.
You may wish to use this script because your wiki's traffic is too slow to clear the queue, or there may be an exceptionally large number of jobs to clear. Be advised though that for many server configurations this can cause your wiki to become sluggish or even unresponsive until the script completes. You are advised to first try 50 or 100 to get a feel for the script's speed before running it for several hundred jobs or with no parameters.
Note also that if you accidentally ran a script that loaded the job queue with a large number of undesired or unneeded jobs it is also possible to completely clear the job queue by clearing the job table in your wiki database. Be certain there are no jobs in the queue you need as all jobs will be irretrievably deleted.
Advanced Usage edit
php runJobs.php [--conf|--dbpass|--dbuser|--globals|--help|--maxjobs|--maxtime|--memory-limit|--nothrottle|--procs|--quiet|--server|--type|--wait|--wiki]
Generic maintenance parameters edit
|Will run all jobs currently in the queue
|Display this help message
|Whether to suppress non-error output
|Location of "LocalSettings.php", if not default
|For specifying the wiki ID
|Output globals at the end of processing for debugging
|Set a specific memory limit for the script, "max" for no limit or "default" to avoid changing it
|The protocol and server name to use in URLs, e.g. https://en.wikipedia.org. This is sometimes necessary because server name detection may fail in command line scripts.
Script dependent parameters edit
|The DB user to use for this script
|The password to use for this script
Script specific parameters edit
|Maximum number of jobs to run
|Maximum amount of wall-clock time (in seconds)
|Number of processes to use
|Type of job to run. See $wgJobClasses for available job types.
|Wait for new jobs instead of exiting
|Ignore the job throttling configuration
|Set to "json" to print only a JSON response
php maintenance/runJobs.php --maxjobs 5 --memory-limit 150M --type refreshLinks
/home/flowerwiki/public_html/w/maintenance$ php runJobs.php --maxjobs 5 --memory-limit 150M --type refreshLinks 2010-10-29 13:50:38 refreshLinks Daisies t=501 good 2010-10-29 13:50:38 refreshLinks Magnolias t=501 good 2010-10-29 13:50:39 refreshLinks Heirloom_Roses t=500 good 2010-10-29 13:50:39 refreshLinks Carnations t=501 good 2010-10-29 13:50:40 refreshLinks Tulips t=563 good
--maxjobs on its own is insufficient, so it is best paired with
--memory-limit. Typical usage involves periodic runs with at least one of the restrictions set to prevent it from running too long in one go.
Possible issues edit
The job queue appears to be stuck edit
Under certain circumstances, "runJobs.php" may hang indefinitely. Some jobs may fail to get completed, clogging up the queue.
As noted above, it is best to prevent this from happening by providing the necessary flags, but if you do find yourself in this situation, ideally you should find the cause of the problem. Possible causes include
- A missing PHP extension in the php.ini of the PHP being run from the command line.
- A buggy extension.
No standard tools or methods are currently available to let you diagnose the issue.
Object caching edit
- Create another "LocalSettings.php" file with object caching disabled:
$wgMainCacheType = CACHE_NONE;
- Then run "runJobs.php" with the
--confparameter to specify the location of the new
LocalSettings.phpfile with caching disabled.
This approach is not recommended, since some jobs will purge objects from the object cache, which won't get purged because caching is disabled. This will result in some updates not being reflected on the wiki.
Terminate a running process edit
Sometimes, if you cannot find the problem and the job queue is creating overhead, you may have no other choice than to terminate it, possibly at the expense of deleting jobs you might need. If this is the case and you accept the risk, you can try to clear the job that you think is causing trouble, or clear the entire jobs table.
Note that on some control panels that use cronjob automation, clearing jobs may have no visible effect. The process initiated may still appear to hang even if there are no jobs left to execute.
- Using a database administration tool
- Go to your database administration tool (e.g. phpMyAdmin) and locate the
- If you're lucky, it may just be an active job that is causing trouble and that needs to be cleared. You can locate it by finding the row that has a hash value in the
- Repeat if necessary. If all else fails, clear the entire jobs table.
- Using manageJobs.php
The maintenance script manageJobs.php does not lend you insights but it does let you delete jobs by group.