WHM Scripts

Valid for version 96

Version:

82

84

88

92

94

96

98

100


Last modified: September 22, 2021

Overview

The cPanel & WHM installation process adds important scripts to your server’s /usr/local/cpanel/scripts and /usr/local/cpanel/bin directories. To run a script, enter its location on the command line. For example, to run the upcp script, run the following command:

/usr/local/cpanel/scripts/upcp
Note:

Unless otherwise noted, use the /usr/local/cpanel/scripts file path for the scripts in this list.

Warning:
  • When you run a script, you must use the script’s full file path, even if you run the script in the /usr/local/cpanel/scripts or /usr/local/cpanel/bin directory.
  • Do not use scripts in the /usr/local/cpanel/scripts or /usr/local/cpanel/bin directories that we do not list in this document. You may damage your server if you run an unlisted script.

Scripts

addpop

This script creates an email account.

auto-adjust-mysql-limits

This script updates the following MySQL® settings in the SQL section of WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings):

  • Allow cPanel & WHM to determine the best value for your MySQL open_files_limit configuration?
  • Allow cPanel & WHM to determine the best value for your MySQL max_allowed_packet configuration?
  • Allow cPanel & WHM to determine the best value for your MySQL innodb_buffer_pool_size configuration?

For more information, read our The auto-adjust-mysql-limits Script documentation.

autossl_check

This script performs a single AutoSSL check. You can run this script for a single user, or for all users. After the script runs, the system will remove any out of date AutoSSL log files.

For more information, read our autossl_check script documentation.

backup

This script runs a manual backup in WHM via the command line.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our backup script documentation.

backups_clean_metadata_for_missing_backups

This script removes the metadata for backup files that a user has manually removed from the system.

For more information, read our The backups_clean_metadata_for_missing_backups Script documentation.

backups_create_metadata

This script creates metadata files for all backup types.

For more information, read our The backups_create_metadata Script documentation.

backups_list_user_files

This script locates a user’s files in compressed, uncompressed, or incremental backups. It returns all files in the backups in Comma Separated Value (CSV) format.

For more information, read our The backups_list_user_files Script documentation.

backup_restore_manager

This script manages the backup restoration queue.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The backup_restore_manager Script documentation.

balance_linked_node_quotas

This script lets you enforce disk use quotas for distributed cPanel accounts.

For more information, read our balance_linked_node_quotas script documentation.

build_maxemails_config

This script sets limits on the amount of email that users can send from domains on your server.

For more information, read our How to Prevent Spam with Mail Limiting Features documentation.

build_mysql_conf

This script builds the default MySQL configuration file.

For more information, read our The build_mysql_conf Script documentation.

ccs-check

This script lets the Calendar and Contacts Server (CSS) plugin run using your server’s SSL certificiate.

For more information, read our The ccs-check Script documentation.

check_cpanel_rpms

This script scans every installed RedHat® Package Manager (RPM) file on your server for problems.

For more information, read our The check_cpanel_rpms Script documentation.

check_security_advice_changes

This script monitors the state of WHM’s Security Advisor. If the state changes, the script will send a notificiation to the system administrator.

Note:

This script runs as part of the nightly maintenance script.

For more information, read our The check_security_advice_changes Script documentation.

check_users_my_cnf

This script checks cPanel accounts for any invalid ~/.my.cnf files and renames them. This lets you view any settings in the invalid files that you may want to copy to new files.

For more information, read our The check_users_my_cnf Script documentation.

checkallsslcerts

This script installs or updates a cPanel-signed hostname certificate.

For more information, read our The checkallsslcerts Script documentation.

Note:

This script exists in the /usr/local/cpanel/bin directory.

chkmydns

This script performs a simple configuration check of MyDNS.

cleandns

This script removes orphaned and duplicate DNS zone definitions.

For more information, read our The cleandns Script documentation.

cleansessions

This script removes various session files for the following applications:

  • phpMyAdmin
  • phpPgAdmin
  • Webmail applications

It also removes the following expired files:

  • cPanel Password Reset session flood protect files.
  • cPanel Subaccount Invitation session and flood protect files.
clean_up_temp_wheel_users

This script removes temporary wheel group users that cPanel Support no longer requires.

Note:

When you use WHM’s Grant cPanel Support Access interface (WHM >> Home >> Support >> Grant cPanel Support Access) and Create Support Ticket interface (WHM >> Home >> Support >> Create Support Ticket), the system will create temporary wheel users for cPanel Support.

clean_user_php_sessions

This script purges expired PHP session files from a secure temporary directory.

For more information, read our The clean_user_php_sessions Script documentation.

comparecdb

This script compares the contents of two Card DataBase (CDB) format files. Specify the two CDB files that you wish to compare. For example, run the following command, where file1 and file2 represent the two files that you wish to compare:

/usr/local/cpanel/scripts/comparecdb file1 file2
configure_rh_ipv6_firewall_for_cpanel

This script sets up your IPv6 firewall. Run this script if either of the following statements are true:

  • You do not manage your IPv6 firewall rules with any other tools or utilities.
  • You cannot connect to your IPv6 addresses or IPv6-enabled websites on port 80.
Important:
  • Only users with root privileges can run this script.
  • The rules that this script creates remain active even if you reboot the server.
  • If your server runs the AlmaLinux OS 8, CentOS 7 or 8, CloudLinux™ 7 or 8, or Red Hat® Enterprise Linux® (RHEL) 7 operating systems: due to the way in which these operating systems manage firewalls, we do not recommend that you use this script.

This script opens the following ports:

  • Port 22 for SSH.
  • Port 53 for DNS.
  • Port 80 for HTTP.
copy_user_mail_as_root

This script copies a cPanel account’s mail to or from a remote server as the root user.

For more information, read our The copy_user_mail_as_root Script documentation.

copy_user_mail_as_user

This script copies a cPanel account’s mail to or from a remote server as the account.

For more information, read our The copy_user_mail_as_user Script documentation.

convert_accesshash_to_token

This script converts a WHM user’s access hash to an API token.

For more information, read our The convert_accesshash_to_token Script documentation.

convert_mdbox_to_maildir

This script converts mailboxes from mdbox format to maildir format.

For more information, read our The convert_mdbox_to_maildir Script documentation.

convert_maildir_to_mdbox

This script converts mailboxes from maildir format to mdbox format.

For more information, read our The convert_maildir_to_mdbox Script documentation.

convert_roundcube_mysql2sqlite

This script converts the Roundcube database from MySQL to SQLite.

For more information about this script, read our How to Convert Roundcube to SQLite documentation.

cpaddonsup

This script updates the cPAddons service.

cpanel_dovecot_solr_rebuild_index

This script rebuilds your Apache Solr™ index files if they become corrupt.

Note:

This script exists in the /usr/local/cpanel/3rdparty/scripts directory.

For more information, read our The cpanel_dovecot_solr_rebuild_index Script documentation.

cpbackup

This script backs up all cPanel accounts.

cpdig

This script performs a DNS query with cPanel & WHM’s DNS resolver. This script’s result should equal the dig +trace command’s end result. For example, run the following command, where www.example.com is a domain and AAAA is a type of domain record:

cpdig www.example.com AAAA
cpuser_port_authority

This script assigns one or more five-digit port numbers for a user’s exclusive use.

For more information, read our The cpuser_port_authority Script documentation.

dbmaptool

This script grants ownership of databases and database users to a cPanel account.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The dbmaptool Script documentation.

dbstoregrants

This script synchronizes MySQL user’s grants for the YAML and JSON files in the /var/cpanel/databases/ directory.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The dbstoregrants Script documentation.

delpop

This script removes an email account.

dnssec-cluster-keys

This script syncs and revokes currently active DNSSEC keys in a DNS cluster.

For more information, read our The dnssec-cluster-keys Script documentation.

dovecot_maintenance

This script deletes expired messages from trash folders. It also cleans out invalid usernames from the database tables. Use the Trash Expire Time setting in WHM’s Mailserver Configuration interface (WHM >> Home >> Service Configuration >> Mailserver Configuration) to set the expiration time. To activate this script, select the Auto Expunge Trash checkbox.

Note:

This script runs while the nightly maintenance script runs.

dumpcdb

This script displays the contents of a CDB file. Specify the CDB file that you wish to view. For example, run the following command, where file represents the file that you wish to view:

/usr/local/cpanel/scripts/dumpcdb file
ea4_fresh_install

This script installs EasyApache 4.

email_hold_maintenance

This script removes the tracking file for email hold on mail to release or delete from the mail queue.

empty_user_trash

This script purges expired files from .trash folders in user home directories. Use the Age of content to purge from users’ File Manager Trash setting in the System section of the WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings) to set the expiration time.

Note:
  • This script runs while the nightly maintenance script runs.
  • This script exists in the /urs/local/cpanel/bin directory.
enable_spf_dkim_globally

This script enables SPF and DKIM for every cPanel user on the server. Then it creates SPF and DKIM records for all of these users’ domains.

For more information, read our The enable_spf_dkim_globally Script documentation.

eximstats_spam_check

This script scans the eximstats database and counts the number of emails that every domain on the server has sent in the previous hour. If a domain exceeds the preconfigured threshold of unique outbound messages (excluding mailing lists), the system will log an alert. Use the following settings in the Mail section of WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings) to configure this script:

  • Number of unique recipients per hour to trigger potential spammer notification — Configure the threshold value of unique outbound messages.
  • Select the action for the system to take on an email account when it detects a potential spammer — Configure the script to take no action, hold, or reject additional outbound messages if the domain exceeds the threshold value.
exportmydnsdb

This script exports zones from MyDNS for BIND and NSD to use.

find_and_fix_rpm_issues

This script detects issues with your server’s RPM database and, if problems exist, rebuilds the database.

For more information, read our The find_and_fix_rpm_issues Script documentation.

find_outdated_services

This script checks all services to determine whether they require a restart. An outdated service is any service that depends on a library that is no longer present on the system.

For more information, read our The find_outdated_services Script documentation.

fix_addon_permissions

This script adjusts the permissions on cPAddon-specific files that contain sensitive information. This script only adjusts cPAddons that follow cPanel & WHM’s tight security model.

Warning:

Some cPAddons possess security-sensitive files, such as files that contain passwords in clear text. cPAddons that exist on servers that do not use the mpm-itk, mod_ruid2, or mod_suphp modules require additional file permission adjustments to prevent security issues between users. For security reasons, we do not recommend that you install any cPAddons on shared hosting servers without one of these modules.

fix_dns_zone_ttls

This script fixes problems with TTL values in DNS zone files.

For more information, read our The fix_dns_zone_ttls Script documentation.

fixmailinglistperms

This script repairs permissions for all mailing list files and directories.

fixndc

This script resolves ndc connection refused errors. To use this script, run the following commands:

1
2
3
/scripts/upcp
/scripts/fixndc
/scripts/fixndc
Important:

You must run the /scripts/fixndc script twice.

fix-web-vhost-configuration

This script scans each user’s web virtual host (vhost) configuration files and removes excess alias names from the serveralias parameter.

For more information, read our The fix-web-vhost-configuration Script documentation.

gather_update_log_stats

This script sends update logs to cPanel, L.L.C. for analysis.

For more information, read our The gather_update_log_stats Script documentation.

gather_update_logs_setupcrontab

This script scheduling when to send update logs to cPanel, L.L.C. for analysis.

For more information, read our gather_update_logs_setupcrontab documentation.

hook

This script executes standardized hooks.

For more information, read our The hook Script documentation.

importmydnsdb

This script imports zone information into NSD from MyDNS or BIND.

install_cpaddons

This script manages the cPAddon third-party software packages.

Note:
  • This script runs while the nightly maintenance script runs.
  • This script exists in the /usr/local/cpanel/bin/ directory.
install_cpanel_analytics

This script installs the cPanel Analytics plugin.

install_dovecot_fts

This script enables Internet Message Access Protocol (IMAP) Full-Text Search (FTS) Indexing (powered by Aparche Solr™). This service provides fast search capabilities for IMAP mailboxes.

For more information, read our The install_dovecot_fts Script documentation.

install_plugin

This script installs a cPanel plugin.

Important:

Only the root user can run this script.

For more information, read our The install_plugin Script documentation.

installpostgres

This script installs PostgreSQL®.

is_script_stuck

This script checks how long a script’s current proces ID (PID) has run. It can also notify a WHM user or kill the process.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The is_script_stuck Script documentation.

maintenance

This script performs system updates. It also terminates the processes that you specify in WHM’s Background Process Killer interface (WHM >> Home >> System Health >> Background Process Killer).

Note:

This script runs while the /usr/local/cpanel/scripts/upcp script runs.

manage_greylisting

This script manages the Greylisting service.

For more information, read our The manage_greylisting Script documentation.

manage_mysql_profiles

This script allows you to import and export MySQL profiles.

For more information, read our The manage_mysql_profiles Script documentation.

migrate_legacy_wordpress_to_modern_wordpress

This script converts legacy cPAddon WordPress® installations to the RPM-based WordPress cPAddon.

For more information, read our The migrate_legacy_wordpress_to_modern_wordpress Script documentation.

modify_accounts

This script updates the theme for specific accounts on the server.

For more information, read our The modify_accounts Script documentation.

modify_packages

This script updates the theme for specific packages on the server.

For more information, read our The modify_packages Script documentation.

modsec_vendor

This script manages the vendors in your server’s ModSecurity® installation.

For more information, read our The modsec_vendor Script documentation.

onboot_handler

This script runs any scripts that exist in the /var/cpanel/on_boot and /usr/local/cpanel/libexec/on_boot directories.

Note:
  • The system runs scripts that exist in /var/cpanel/on_boot and /usr/local/cpanel/libexec/on_boot automatically when it reboots.
  • This script exists in the /usr/local/cpanel/bin/ directory.

For more information, read our The onboot_handler Script documentation.

php_fpm_config

This script installs configuration files when you manually edit the PHP-FPM configuration files.

For more information, read our The php_fpm_config Script documentation.

pkgacct

This script creates a backup file for a cPanel account.

For more information, read our The pkgacct Script documentation.

process_site_templates

This script processes template files and user-provided data to create a Site Publisher website.

For more information, read our The process_site_templates Script documentation.

purge_modsec_log

This script removes stale records from the modsec database.

realperlinstaller

This script automates the installation of Comprehensive Perl Archive Network (CPAN) modules.

rebuildhttpdconf

This script rebuilds Apache®’s main configuration file.

For more information, read our The rebuildhttpdconf Script documentation.

rebuild_dbmap

This script rebuilds a user’s corrupted database map.

For more information, read our The rebuild_dbmap Script documentation.

rebuild_phpconf

This script manages your server’s default PHP version and PHP handlers in EasyApache 4.

Note:

This script exists in the /usr/local/cpanel/bin/ directory.

For more information, read our The rebuild_phpconf Script documentation.

rebuild_available_rpm_addons_cache

This script rebuilds the available RPM-based cPAddons cache in the /var/cpanel/available_rpm_addons.cache file.

rebuild_whm_chrome

This script rebuilds the PHP cache of the WHM interface’s header and footer (chrome) files. This includes the WHM’s interface’s left navigation panel. When you run the script, it processes these files for the root user and all resellers, then saves the results to files you can use to develop third-party plugins.

Important:

When you run this script, the system will remove the previous save files before it recreates them.

For information about WHM plugins, read our Guide to WHM Plugins documentation.

remove_dovecot_index_files

This script removes the Dovecot index logs and cache files from cPanel email accounts.

For more information, read our The remove_dovecot_index_files Script documentation.

removeacct

This script removes a cPanel account.

For more information, read our The removeacct Script documentation.

rescan_user_dovecot_fts

This script performs a full text search (FTS) scan on a cPanel account’s mailboxes.

For more information, read our The rescan_user_dovecot_fts Script documentation.

restartsrv

This script restarts a specific service.

For more information, read our The restartsrv Scripts documentation.

restorepkg

This script lets you restore a cPanel account from a backup file.

For more information, read our The restorepkg Script documentation.

rpmup

This script updates the system software for all users.

runstatsonce

This script updates all user statistics.

runweblogs

This script updates a user’s statistics. To run this script, use the following command, where username is the cPanel account username:

/usr/local/cpanel/scripts/runweblogs username
secureit

This script secures permissions on your server.

For more information, read our The secureit Script documentation.

securemysql

This script secures a cPanel account’s MySQL configuration.

For more information, read our The securemysql Script documentation.

securetmp

This script mounts the /tmp partition to a temporary file for extra security.

For more information, read our The securetmp Script documentation.

servers_queue

This script manages server queue tasks. cPanel & WHM’s task queue system uses this script.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The servers_queue Script documentation.

servicedomains

This scripts allows you to create service subdomain DNS records for a cPanel, WHM, or Webmail account from the command line.

For more information, read our The servicedomains Script.

set_php_memory_limits

This script adjusts the memory_limit directive value for all versions of PHP in the /opt/cpanel/ directory. It uses the server’s available memory to determine an appropriate value.

Important:

You must use the --run flag to execute this script.

For information about the memory_limit directive, read our MultiPHP INI Editor interface (WHM >> Home >> Software >> MultiPHP INI Editor) documentation.

set-tls-settings

This script manages a server’s Secure Socket Layer (SSL) and Transport Layer Security (TLS) cipher suites and protocols. You can use this script to configure the following services:

  • Web Disk (cpdavd).
  • The cPanel & WHM server (cpsrvd).
  • Exim (exim).
  • The Dovecot mail server (dovecot).
Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The set-tls-settings Script documentation.

setupftpserver

This script allows you to select your server’s FTP server, configure anonymous FTP services, or disable FTP services.

For more information, read our The setupftpserver script documentation.

setup_greylist_db

This script creates the greylist SQLite database. It also allows you to add common email services to the trusted hosts list.

For more information, read our The setup_greylist_db Script documentation.

setup_modsec_db

This script creates the modsec MySQL database and user.

Note:

Running this script does not clear any existing MySQL database or user data.

setupmailserver

This script lets you select a mail server.

Note:

cPanel & WHM only ships with the Dovecot mail server.

For more information, read our The setupmailserver Script documentation.

setupnameserver

This script allows you to switch between DNS servers.

Warning:

We deprecated the MyDNS and NSD nameservers in cPanel & WHM version 78. We plan to remove them in a future release. We strongly recommend that you only switch between the PowerDNS and BIND nameservers.

slurp_exim_mainlog

This script imports all unarchived Exim exim_mainlog data in the /var/log/ directory into the eximstats database.

For more information, read our The slurp_exim_mainlog Script documentation.

spf_installer

This script adds SPF records to all of a user’s domains’ zone files.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The spf_installer Script documentation.

suspendacct

This script suspends a cPanel account.

For more information, read our The suspendacct Script documentation.

swapip

This script lets you update a domain’s IP address in the zone file. It will update the domain’s source IP address with the destination server’s IP address.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The swapip Script documentation.

sync_child_accounts

This script synchronizes a distributed cPanel account between a parent node and its child nodes.

For more information, read our The sync_child_accounts Script documentation.

sync-mysql-users-from-grants

This script creates default MySQL or MariaDB users for any cPanel users that require them.

Note:

When you enable MySQL or MariaDB, the system automatically performs this function. In most cases, you do not need to run this script.

transfer_account_as_user

This script transfers a cPanel account from a remote server to the local server. When you run the script, it authenticates as the cPanel account on the remote server.

For more information, read our The transfer_account_as_user Script documentation.

transfer_accounts_as_root

This script transfers one or more cPanel accounts from a remote server to the local server.

For more information, read our The transfer_accounts_as_root Script documentation.

try-later

This script executes a user-defined check command at a specified interval. If the check command returns an error, it retries as often as the max-retries parameter allows. When the check succeeds, a user-defined action command runs.

For more information, read our The try-later Script documentation.

uninstall_cpanel_analytics

This script uninstalls the cPanel Analytics plugin.

Important:

Only users with root privileges can run this script.

uninstall_plugin

This script uninstalls a cPanel plugin.

For more information, read our The uninstall_plugin Script documentation.

This script restores a service account to an unlinked state.

unsuspendacct

This script unsuspends a cPanel account.

Note:

Unsuspending an account also removes service proxying.

For more information, read the the unsuspend script script documentation.

upcp

This script updates cPanel & WHM.

For more information, read our The upcp Script documentation.

upcp-running

This script determines whether the upcp script is currently running.

For more information, read our The upcp-running Script documentation.

upgrade_subaccount_databases

This script verifies and upgrades the Subaccount database table schemas for each cPanel account.

view_transfer

This script lets you view the logs for a transfer or restore session.

Note:

This script exists in the /usr/local/cpanel/bin directory.

For more information, read our The view_transfer Script documentation.

vps_optimizer

This script optimizes the Maximum Children settings for Apache SpamAssassin™ for the amount of memory on your server.

For more information about the Maximum Children setting, read our Spamd Startup Configuration documentation.

whmlogin

This script generates a single-use session login URL for WHM.

wwwacct

This script creates a cPanel account.

For more information, read our The wwwacct Script documentation.

Additional Documentation