- پشتیبانی از نسخه های
This addon requires PHP 5.4 or higher and has been tested on XenForo 2.0.x and 2.1.x
Install as per normal addon installation.
Note: once this addon is installed and activated, scheduled tasks will no longer run - so completing the remaining installation steps is critical to ensure your forum continues to function normally.
First, you should test that your job runner is functioning - execute the following command from your CLI:
Once you are happy that the job runner functions correctly, you will need to create your own cron task to run it on a schedule of your choosing.
Approach #1 using crontab:
It is highly recommended that you have your cron task run as the web server user to prevent potential permission problems.
For example, on Ubuntu with a web server user of www-data, install a cron task by running the following command:
Approach #2 using cron.d:
Instead of using a crontab, some Linux distributions create a well-known directory which is automatically checked for cron tasks to execute. In the case of Ubuntu, you can create files in /etc/cron.d/ where you specify the schedule, the user to execute the command as, and the command itself.
Create a file in /etc/cron.d/ with the following contents:
Again, using our previous example where web server user is www-data and our forum root is
/srv/www/xenforo/community, I would execute the following command to create the cron file:
By default, the job runner will run for a maximum of 30 seconds, executing any outstanding jobs until there are no more runnable jobs in the queue.
You may adjust the maximum execution time of the job runner by specifying the --time=[TIME] option on the command line.
For example, to allow the job runner to execute for a maximum of 45 seconds:
If you prefer to not run the cron task as frequently as once per minute, you can adjust the cron job as
required and if you do, you may also want to allow the job runner task to run for longer than the default 30 seconds to ensure that all outstanding work is completed.
For example, to run the cron task every 5 minutes, allowing the job runner to execute for a maximum of 4 minutes, use the following cron command:
This is configured via a XenForo config.php Option:
The run-jobs command should be executed automatically using a cron task as per the instructions above.
The xf:show-jobs command outputs a list of all the currently pending jobs, so you can see how full the jobs queue is.
By default only the next scheduled 100 jobs will be shown, you may use the --all option to show a complete list of all pending jobs.
There should always be at least one job (the main Cron job) in the list. For XF 2.1 you will also see the upgrade check job.