Child pages
  • The Task Queue System
For cPanel & WHM version 70

Skip to end of metadata
Go to start of metadata

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:

    Id: TQ:TaskQueue:3

    In this example, TQ:TaskQueue:3 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:

     

     No known processor for 'command'. at /usr/local/lib/perl5/site_perl/5.8.8/
/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:

1 tasks unqueued
/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:

    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:

     No known processor for 'command'. at /usr/local/lib/perl5/site_perl/5.8.8/
/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:

1 tasks unscheduled
/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 jobs immediately. This argument does not return output.
/usr/local/cpanel/bin/servers_queue run
helpUse this argument to display usage information for the script.
/usr/local/cpanel/bin/servers_queue help

Task queue subprocesses

The following table lists the subprocesses in the /usr/local/cpanel/Cpanel/TaskProcessors directory that services can pass to the /usr/local/cpanel/bin/servers_queue script:

ModuleFunction
ApacheTasks.pm

apache_restart

ApacheTasks.pm

build_apache_conf

API.pmverify_api_spec_files
BackupMetadataConversion.pmbackups_create_metadata
BackupMetadata.pmvacuum_metadata
BackupMountTasks.pm

release_mount_lock

BandwidthDBTasks.pm

create_bandwidthdb

BINDTasks.pmrndc
CgiCleanupTasks.pm

clean_cgiemail

CheckRPMTasks.pm

check_cpanel_rpms

CheckRPMTasks.pm

update_horde_config

ClamTasks.pmfresh_clam
CPAddons.pm

rebuild_available_rpm_addons_cache

CpDBTasks.pm

ftp_update

CpDBTasks.pm

update_userdata_cache

CpDBTasks.pm

build_global_cache

CpDBTasks.pm

update_domainips_and_deps

cPHulkTasks.pm

purge_old_logins

cPHulkTasks.pmadd_known_ip_for_user
cPHulkTasks.pm

notify_login

cPHulkTasks.pm

notify_brute

cPHulkTasks.pm

update_country_ips

Cplisc.pmcheck
CpServicesTasks.pm

startcpsrvd

CpServicesTasks.pmrestartsrv
CpServicesTasks.pmsetupservice
CpServicesTasks.pmhupcpsrvd
DAV.pmdav_change_hostname
DKIMTasks.pm

setup_dkim_keys

DKIMTasks.pmupdate_keys
DKIMTasks.pmenable_spf_dkim_globally
DNSTasks.pmremove_zones
DovecotTasks.pm

flush_dovecot_auth_cache

DovecotTasks.pmflush_entire_account_dovecot_auth_cache
DovecotTasks.pmbuild_mail_sni_dovecot_conf
DovecotTasks.pmrestartdovecot
DovecotTasks.pmreloaddovecot
EximTasks.pmbuildeximconf
FilemanTasks.pmempty_trash
HordeTasks.pm

setup_horde_db

HordeTasks.pmclean_horde_db
LocaleTasks.pm

build_locale_databases

LogdTasks.pmrunweblogs
MydnsTasks.pmimportmydnsdb
MysqlTasks.pm

flushprivs

MysqlTasks.pmmysqluserstore
MysqlTasks.pmdbstoregrants
MysqlTasks.pmdbindex
MysqlTasks.pmprotecthomecheck
NameServerIPTasks.pm

updatenameserveriplist

NotificationTasks.pm

notify

NotificationTasks.pmnotify_from_subqueue
PaperLantern.pmpl_update_users
PerlModuleTasks.pminstalltaskcpanelcore
PHPFPMTasks.pm

ensure_fpm_on_boot

PHPFPMTasks.pmenable_fpm
PHPFPMTasks.pmrebuild_fpm
PluginTasks.pm

install_plugin

PluginTasks.pmuninstall_plugin
ProxySubdomains.pm

check_proxy_subdomains

ProxySubdomains.pmremove_autodiscover_proxy_subdomains
ProxySubdomains.pmadd_autodiscover_proxy_subdomains
ProxySubdomains.pmupdate_autodiscover_proxy_subdomains
ProxySubdomains.pm

remove_proxy_subdomains

ProxySubdomains.pmadd_proxy_subdomains
ResellerTasks.pm

setup_reseller_and_sync_web_vhosts

RubyTasks.pm

write_gemrc

SpamassassinTasks.pmenable_spamassassin
SSLCleanupTasks.pm

autossl_purge_user

SSLCleanupTasks.pmunset_tls
SSLTasks.pm

instal_best_available_certificate_for_domain

SSLTasks.pmautossl_check
SystemTasks.pmrecache_system_reboot_data
TailwatchTasks.pm

restarttailwatch

TailwatchTasks.pmreloadtailwatch
TailwatchTasks.pmeximstats_import_sql_file
TemplateTasks.pmrebuild_templates
TestTasks.pmsleep
WHMChromeTasks.pmrebuild_whm_chrome

Additional documentation