Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
LIB:_Version68
LIB:_Version68

Table of Contents
stylenone

Overview

Events in cPanel & WHM often cause one or more services to restart. For example, if you add a subdomain, the system restarts Apache and the nameserver daemon. On busy servers, these restart requests can degrade the quality of service.

To handle these requests, cPanel & WHM includes a system to queue and process tasks from various subsystems. Those subsystems do not perform restarts and other requests directly. Instead, the task queue system combines multiple instances of an outstanding request into a single action in order to improve server response time.

  • The queueprocd daemon, which resides in the /usr/local/cpanel/libexec directory, processes the task queue periodically. The startup process starts this daemon. To manage the daemon, use the /usr/local/cpanel/scripts/restartsrv_queueprocd script.
  • The chksrvd daemon monitors the queueprocd daemon.
  • The task queue system stores the queue of tasks as JSON files in the /var/cpanel/taskqueue directory. 

The servers_queue script

The task queue system uses the /usr/local/cpanel/bin/servers_queue script to manage task queue tasks.

You can use the following arguments when you call the /usr/local/cpanel/bin/servers_queue script:

ArgumentDescriptionExample
queue

Use this argument to pass a quoted command string to add to the task queue.

  • If the system successfully adds that command to the task queue, you will receive a message that resembles the following example:

    Code Block
    languagetext
    Id: TQ:TaskQueue:3

    In this example, TQ:TaskQueue:8 represents the task's ID number in the task queue.

  • If you pass an invalid command to the task queue, you will receive the following error message, where command represents the command that you specified:

     

    Code Block
    languagetext
     No known processor for 'command'. at /usr/local/lib/perl5/site_perl/5.8.8/



Code Block
languagebash
/usr/local/cpanel/bin/servers_queue queue 'apache_restart'


unqueue

Use this argument to remove a task from the task queue. When you use this argument, you must pass the task's unique task ID with it. The system outputs this number when you queue a task, or you can find the task ID number in the/var/cpanel/taskqueue/servers_queue.json file.

If the system successfully removes the task, you will receive a success message that resembles the following example:

Code Block
languagetext
1 tasks unqueued



Code Block
languagebash
/usr/local/cpanel/bin/servers_queue unqueue TQ:TaskQueue:3


schedule

Use this argument to pass a wait time, in seconds, and a quoted command string to add to the task queue. The task queue will not process the command until after the wait time passes.

  • If the system successfully adds the command to the task queue, you will receive a message that resembles the following example:

    Code Block
    languagetext
    Id: TQ:TaskQueue-Scheduler:43

    In this example, TQ:TaskQueue-Scheduler:43 represents the task's ID number in the task queue.

  • If you pass an invalid command to the task queue, you will receive the following error message, where command represents the command that you specified:

    Code Block
    languagetext
     No known processor for 'command'. at /usr/local/lib/perl5/site_perl/5.8.8/



Code Block
languagebash
/usr/local/cpanel/bin/servers_queue schedule 600 'apache_restart'


unschedule

Use this argument to remove a task from the task queue. When you use this argument, you must pass the task's unique task ID with it. The system outputs this number when you queue a task, or you can find the task ID number in the/var/cpanel/taskqueue/servers_queue.json file.

If the system successfully removes the task, you will receive a success message that resembles the following example:

Code Block
languagetext
1 tasks unscheduled



Code Block
languagebash
/usr/local/cpanel/bin/servers_queue unschedule TQ:TaskQueue-Scheduler:43


runUse this argument to perform a synchronous flush of the task queue, which runs all of the task queue's queued items immediately. This argument does not return output.


Code Block
languagebash
/usr/local/cpanel/bin/servers_queue run


helpUse this argument to display usage information for the script.


Code Block
languagebash
/usr/local/cpanel/bin/servers_queue help


Task queue subprocesses

The task queue system receives requests from many systems and services within cPanel & WHM. The following table does not include every subprocess and its related actions, but instead provides examples of the task queue's functionality:

ActionRelated cPanel or WHM interface
Create a new account.WHM's Create a New Account interface (WHM >> Home >> Account Functions >> Create a New Account)
Modify an account.WHM's Modify an Account interface (WHM >> Home >> Account Functions >> Modify an Account)
Terminate an account.WHM's Terminate Accounts interface (WHM >> Home >> Multi Account Functions >> Terminate Accounts)
Upgrade or downgrade an account.WHM's Upgrade Downgrade an Account interface (WHM >> Home >> Account Functions >> Upgrade/Downgrade an Account)
Change the IP address for a site.WHM's Change Site's IP Address interface (WHM >> Home >> Account Functions >> Change Site's IP Address)
Apache-related functions that are in the Tweak Settings interface.WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings)
Copy an account from another server.WHM's Transfers section (WHM >> Home >> Transfers)
Add or remove an addon domain.cPanel's Addon Domains interface (cPanel >> Home >> Domains >> Addon Domains)
Create or remove a subdomain.cPanel's Subdomains interface (cPanel >> Home >> Domains >> Subdomains)
Create or remove an alias (parked domain).cPanel's Aliases interface (cPanel >> Home >> Domains >> Aliases)

Additional documentation

Localtab Group


Localtab
activetrue
titleSuggested documentation

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel = "services" and label = "whm" and space = currentSpace()


Localtab
titleFor cPanel users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel = "services" and label = "cpanel" and space = currentSpace()


Localtab
titleFor WHM users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel = "services" and label = "whm" and space = currentSpace()


Localtab
titleFor developers

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel = "services" and space = "SDK"