• هاست سان
  • با خرید اشتراک ویژه شما میتوانید جدیدترین آپدیت افزونه ها و قالب های زیبا و پرکاربرد زنفورو را دریافت کنید!

    هر ماه یک کد تخفیف 60 درصدی محصولات فروشگاه به کاربران منتخب بخش ویژه اهدا می‌شود

CLI Job Runner

افزونه 2 CLI Job Runner 1.5.0

دسترسی دریافت را ندارید
CLI Job Runner
نمای کلی منبع
استفاده از یک CLI برای استفاده از کران یونیکس
XFFA.IR Bot توسط XFFA.IR Bot Stable
1.5.0 نسخه
1 دریافت‌ها
352 بازدیدها
— رتبه‌بندی
اولین انتشار
آخرین بروزرسانی
سازگاری
توسط نویسنده مشخص نشده است
توسعه‌دهنده
XFFA.IR Bot
XFFA.IR Bot
تاریخ عضویت: ارسالی‌ها: 26,276 واکنش‌ها: 3,286
پشتیبانی از نسخه های
  1. 2.0
  2. 2.1
This XenForo 2.x addon disables the browser triggered job runner and implements a CLI triggered job runner for use with Unix cron.

Requirements

This addon requires PHP 5.4 or higher and has been tested on XenForo 2.0.x and 2.1.x

Installation

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:
Bash:
$ php <path to your forum root>/cmd.php xf:run-jobs
For example, if your forum root is /srv/www/xenforo/community, then the job runner command would be:
کد:
$ php /srv/www/xenforo/community/cmd.php xf:run-jobs
Running this command will execute any outstanding jobs and then finish with a message about whether there are more jobs waiting to be executed or not. When executing this command from cron, it is recommended that you use the --quiet (or -q) flag to suppress output.

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:
Bash:
$ sudo crontab -u www-data -e
Edit the crontab file and add:
ASP.net:
    *       *       *       *       *       php /path/to/your/forum/root/cmd.php --quiet xf:run-jobs
Save the crontab.

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:
Bash:
* * * * * [ICODE]webserver-user[/ICODE] php /path/to/your/forum/root/cmd.php --quiet xf:run-jobs
... where webserver-user is changed to the name of the user your web server runs as and change the path to your forum root.

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:
Bash:
echo "* * * * * www-data php /srv/www/xenforo/community/cmd.php --quiet xf:run-jobs" | sudo tee -a /etc/cron.d/xenforo
Both options (crontab and cron.d) will execute the job runner every minute, checking for outstanding jobs to be run.

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.

Configuration

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:
Bash:
$ php <path to your forum root>/cmd.php --time=45 xf:run-jobs
It is not recommended that you allow the job runner to run for longer than the period between cron triggers. For example, the above cron task example will execute the job runner every minute, so setting the maximum run time to more than 60 is generally a bad idea.

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:
Bash:
*/5       *       *       *       *       php <path to your forum root>/cmd.php --quiet --time=240 xf:run-jobs
For further customisation of your job execution, you may also adjust the maximum time that each job is permitted to run.
This is configured via a XenForo config.php Option:
PHP:
$config['jobMaxRunTime'] = 8;
You should not set jobMaxRunTime to anything higher than 30 seconds, or the time specified by the --time option. In general it is suggested that this setting be kept to a relatively small value to avoid the situation where a single very long job may prevent other jobs from executing in a timely manner. Some experimentation may be required to find the optimal value for your server load and forum size.

Usage

The run-jobs command should be executed automatically using a cron task as per the instructions above.

Show Jobs

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.
Bash:
$ php cmd.php xf:show-jobs                       

2 pending jobs found

+----------------+-----------------+----------------------+----------------------+
| Key            | Class           | Next Run             | Last Run             |
+----------------+-----------------+----------------------+----------------------+
| cron           | XF\Job\Cron     | 11-Apr-2019 10:52:01 | 11-Apr-2019 10:52:31 |
| xfUpgradeCheck | XF:UpgradeCheck | 12-Apr-2019 00:12:21 | 10-Apr-2019 21:24:03 |
+----------------+-----------------+----------------------+----------------------+

The current time is: 11-Apr-2019 10:52:31 (UTC+10:00)
نویسنده
XFFA.IR Bot
دریافت‌ها
1
بازدیدها
352
اولین انتشار
آخرین بروزرسانی

رتبه‌بندی‌ها

0.00 ستاره 0 رتبه‌بندی

فایل‌های بیشتری از XFFA.IR Bot

آخرین بروزرسانی‌ها

  1. CLI Job Runner 1.5.0

    v1.5.0 makes some back-end changes to the way we manage the lock files and fixes an issue where...
  2. Minor update - upgrade not necessary

    v1.4.2 simply adds a check for the installer to prevent installation on XenForo 2.2 - need to...

فایل‌های مشابه

CLI Job Runner for XF 2.2 XFFA.IR Bot
یک CLI پیشرفته که باعث ایجاد افزایش کارایی برای یونیکس کران میشود با پشتیبانی از اشکال زدایی.
دریافت‌ها
0
به‌روزرسانی شده
Attachment Integrity Check (CLI) King
حذف کردن پیوست‌هایی که فایل ذخیره‌شده‌شان مفقود شده است، پیدا و تعمیر کنید و به‌صورت ایمن .
دریافت‌ها
0
به‌روزرسانی شده
عقب
بالا