This documentation is for cPanel & WHM version 74 CURRENT builds.  The "RELEASE" version of our documentation can be found in the Version 72 Documentation space.

Skip to end of metadata
Go to start of metadata


Overview

When cPanel & WHM installs, cPanel-provided scripts become available in your server’s /usr/local/cpanel/scripts directory. To run a script, enter its location on the command line. For example, to run the update script, run the following command:

/usr/local/cpanel/scripts/upcp 

Warnings:

  • 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 directory.
  • Do not use scripts in the /usr/local/cpanel/scripts directory that we do not list in this document. You may damage your server if you run those unlisted scripts.

Scripts

ScriptDescription
addpopAdds a POP account.
backups_clean_metadata_for_missing_backups

Removes the metadata for backup files that a user manually removed from the system.

For more information, read our The backups_clean_metadata_for_missing_backups Script documentation.

backups_create_metadata

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. The script returns all files in the backups in Comma Separated Value (CSV) format.

For more information, read our The backups_list_user_files Script documentation.
build_maxemails_configSets limits on the amount of email that users can send from domains on your server. For more information about this script's limits, read our Mail Limiting Features documentation.
check_users_my_cnf

Checks user accounts for ~/.my.cnf files that do not work, and disable them. This script only returns output when it detects a bad .my.cnf file.

Note:

For more information, run the following command:

/usr/local/cpanel/scripts/check_users_my_cnf --help
checkallsslcerts

Installs or updates a cPanel-signed hostname certificate. For more information, read our The checkallsslcerts Script documentation.

Note:

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


chkmydnsPerforms a simple configuration check of MyDNS.
cleansessions

Removes various session files for the following applications:

  • phpMyAdmin
  • phpPgAdmin
  • Horde
  • Roundcube
  • SquirrelMail

Removes the following expired files:

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


Note:

For more information, run the following command:

/usr/local/cpanel/scripts/cleansessions --help

clean_up_temp_wheel_users

Removes any temporary wheel group users that are no longer necessary for cPanel Support's access to the server.

Note:

WHM's Grant cPanel Support Access (WHM >> Home >> Support >> Grant cPanel Support Access) and Create Support Ticket (WHM >> Home >> Support >> Create Support Ticket) interfaces can create temporary wheel users to allow cPanel Support access to your server.

clean_user_php_sessions

Purges expired PHP session files from a secure temporary directory. This script checks the session.gc_maxlifetime and session.save_path variables in the global php.ini file and determines when to remove the PHP session files. We recommend that this script run at least once per day to remove old PHP session files.

For more information about PHP session files, read our MultiPHP INI Editor for WHM documentation.

Notes:

  • When the /usr/local/cpanel/scripts/maintenance script runs, the system adds the /usr/local/cpanel/scripts/clean_user_php_sessions script to the root user's crontab.
  • If you customize the session.gc_maxlifetime value, but do not customize the session.save_path value, the script will not use the session.gc_maxlifetime variable value.
  • This script only recognizes the global session.gc_maxlifetime PHP configuration value for each version of PHP.
  • If this script detects different values in the session.gc_maxlifetime variable, but the system stores the session data in a single location, the script will use the minimum value to determine when to purge expired session files.
comparecdb

Compares the contents of two CDB files. Specify the two CDB files that you wish to compare after the script.

Note:

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

Sets up your IPv6 firewall. Any user with root privileges can run this script. 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.

Notes:

  • The rules that this script creates remain active even if you reboot the server.
  • Due to the way in which CentOS 7, CloudLinux™ 7, and Red Hat® Enterprise Linux (RHEL) 7 manage firewalls, we do not recommend that you use this script if your server uses one of those operating systems. 

This script performs the following actions:

  • Opens port 22 for SSH.
  • Opens port 53 for DNS.
  • Opens port 80 for HTTP.
convert_accesshash_to_token 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

Converts mailboxes from mdbox format to maildir format. For more information, read our The Mailbox Format Conversion Scripts documentation.
convert_roundcube_mysql2sqlite

Converts the Roundcube database from MySQL® to SQLite.

Warning:

You may need to convert individual accounts, even after the database conversion. To convert individual cPanel accounts that use Roundcube to SQLite, add the username as the parameter:

/usr/local/cpanel/scripts/convert_roundcube_mysql2sqlite user
copy-etc-filesCreates customized copies of your /etc/bashrc, /etc/issue, and /etc/issue.net files in the /etc directory.
cpbackupBacks up all accounts.
delpopRemoves a POP account.
dovecot_maintenance

Runs nightly and deletes messages from trash folders that are older than the Trash Expire Time value in WHM's Mailserver Configuration interface (WHM >> Home >> Service Configuration >> Mailserver Configuration). To activate this script, select the Auto Expunge Trash checkbox.

It also cleans out invalid usernames from the database tables.

dumpcdb

Displays the contents of a CDB file. Specify the CDB file that you wish to view.

Note:

For example, run the following command, where file represents the file that you wish to view:

/usr/local/cpanel/scripts/dumpcdb file
easyapacheUpgrades and reinstalls Apache.
email_hold_maintenance

Removes the tracking file for email holds released or deleted from the mail queue.

empty_user_trash

Purges files from .trash folders in user home directories that are older than 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).

Notes:

  • This script runs as a part of the nightly maintenance script.
  • This script exists in the /usr/local/cpanel/bin/ directory.
enable_spf_dkim_globally

Enables SPF and DKIM for every cPanel user on the server, and then creates SPF and DKIM records for all of these users' domains. For more information, read our The SPF and DKIM Global Settings Script documentation.

eximstats_spam_check

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 has exceeded the preconfigured threshold of unique outbound messages (excluding mailing lists), the system will log an alert.

Note:

You can configure the threshold value of unique outbound messages in WHM's Tweak Settings interface. This setting defaults to a threshold of 500 unique outbound messages.

exportmydnsdbExports zones from MyDNS for use with BIND and NSD.
fix_addon_permissions

Adjusts the permissions on cPAddon-specific files that contain sensitive information. This script only adjusts cPAddons that support the tighter security model that we introduced in cPanel & WHM version 64.

Note:

Some cPAddons possess security-sensitive files, such as files that contain passwords in clear text. cPAddonsthat 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.

fixmailinglistpermsRepairs permissions for all mailing list files and directories.
fixndc

Resolves ndc connection refused errors. To correctly use this script, run the following commands:

/scripts/upcp
/scripts/fixndc
/scripts/fixndc

Important:

You must run the /scripts/fixndc script twice.

gather-update-logsSends update logs to cPanel, Inc. for analysis.
hookExecutes any hooks that the system would normally call in the specified context.
importmydnsdbImports zone information from BIND and NSD into MyDNS.
install_cpaddons

Manages the cPAddons third-party software packages.

Notes:

  • This script runs as a part of the nightly maintenance script.
  • This script exists in the /usr/local/cpanel/bin/ directory.
install_dovecot_ftsEnables Internet Message Access Protocol (IMAP) Full-Text Search (FTS) Indexing (powered by Apache Solr™), which provides fast search capabilities for IMAP mailboxes. For more information, read our The install_dovecot_fts Script documentation.
install_plugin

Installs a cPanel plugin. For more information, read the  Guide to cPanel Plugins  documentation.

Important:

Due to the permissions that the /usr/local/cpanel/scripts/install_plugin script requires in order to access the necessary files, only the root user can run this script successfully.

installpostgresInstalls PostgreSQL®.
installruby

Installs Ruby.

Important:

We deprecated this script in cPanel & WHM version 66. 

installzendoptsInstalls and activates Zend Optimizer.
is_script_stuck

Checks how long a script's current PID has run, and can notify a WHM user or kill the process. For more information, read our The is_script_stuck Script documentation.

Note:

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

maintenance

Performs system updates, and terminates the processes that you specify in WHM's Background Process Killer interface (WHM >> Home >> System Health >> Background Process Killer).

Note:

This script runs as a part of the /usr/local/cpanel/scripts/upcp script.

manage_greylistingManages the cPanel Greylisting service. For more information, read The manage_greylisting Script documentation.
modsec_vendorLists, adds, removes, or updates ModSecurity™ vendors.
modify_accounts

Updates the theme for specific accounts on the server.

Note:

For more information, read the scripts/modify_accounts  documentation or run the following command: 

/usr/local/cpanel/scripts/modify_accounts --help
modify_packages

Updates the theme for specific packages located on the server.

Note:

For more information, read the scripts/modify_packages documentation or run the following command: 

/usr/local/cpanel/scripts/modify_packages --help
onboot_handler

Runs any scripts found in the /var/cpanel/on_boot  or  /usr/local/cpanel/bin/on_boot  directories when the server boots.

Note:

Any scripts that you add to the /var/cpanel/on_boot and /usr/local/cpanel/libexec/on_boot directories automatically run each time that the system reboots.

For more information, read our The onboot_handler Script documentation.
php_fpm_config Installs configuration files when you manually edit the PHP-FPM configuration files.
phpextensionmgrManages PHP extensions.
pkgacctHandles cPanel packages. For more information, read our /scripts/pkgacct — Package a cPanel account documentation.
process_site_templatesProcesses template files and user-provided data to create an Site Publisher website.
purge_modsec_logRemoves stale records from the modsec database.
realperlinstaller

Automates the installation of CPAN modules.

rebuild_dbmapRebuilds a user's corrupted database map.
rebuild_phpconf

Manages your server's default PHP version and PHP handlers in EasyApache 4. For more information, read our The rebuild_phpconf Script documentation.

Note:

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

rebuild_available_rpm_addons_cacheRebuilds the available RPM-based cPAddons cache in the /var/cpanel/available_rpm_addons.cache file.
rebuild_whm_chromeRebuilds the PHP cache of the WHM interface's chrome. For more information, read our Guide to WHM Plugins documentation.
removeacctRemoves a cPanel account.
restartsrv_*

Restarts a service. For more information, read our How to Restart Services documentation.

We currently provide restart scripts for the following services (replace the asterisk (*) in restartsrv_* with the desired item below):

apache

Restarts the Apache web server.

bind

Restarts the BIND nameserver software.

chkservd

Restarts cPanel’s TailWatch log processing service.

clamd

Restarts the ClamAV antivirus software.

cpanellogd

Restarts the cpanellogd daemon.

cpdavd

Restarts cPanel’s WebDAV server.

cphulkd

Restarts cPHulk.

cpipv6

Binds or rebinds the server's IPv6 addresses. Run this script with the --list flag to list all of the server's bound IPv6 addresses.

cpsrvd

Restarts the cpsrvd daemon.

crond

Restarts the crond daemon.

dnsadmin

Restarts the dnsadmin daemon.

dovecot

Restarts the Dovecot mail server.

exim

Restarts the Exim mail exchanger.

eximstats

Restarts the Exim mail statistics tracker.

ftpd or ftpserver

Restarts the configured FTP service (ProFTPd or Pure-FTPd).

httpd

Restarts the Apache web server.

imap

Restarts the IMAP server (Dovecot).

inetd

Restarts the super-server daemon that manages Internet services.

ipaliases

Restarts the IP address aliasing software.

mailman

Restarts Mailman.

mydns

Restarts the MyDNS server.

mysql

Restarts the MySQL database server.

named

Restarts the BIND nameserver software.

nsd

Restarts the NSD nameserver daemon.

p0f

Restarts the passive OS fingerprinting service.

postgres or postgresql

Restarts the PostgreSQL database service.

proftpd

Restarts the ProFTPd server daemon.

pureftpd

Restarts the Pure-FTPd server daemon.

queueprocd

Restarts the queueprocd daemon.

rsyslogd

Restarts the open-source log forwarder daemon.

spamd

Restarts the Apache SpamAssassin™ daemon.

sshd

Restarts the Secure shell daemon.

syslogd

Restarts the Log forwarder daemon.

tailwatchd

Restarts cPanel’s TailWatch log processing service.

tomcat

Restarts the Apache Tomcat service.


Important:

EasyApache 3 does not support new installations of Tomcat.

EasyApache 4 now supports Tomcat 8.5 on an Experimental basis. You must install the Experimental Repository to use Tomcat and create a new Tomcat installation. You cannot migrate from EasyApache 3 to EasyApache 4 if your server runs Tomcat. We will add this functionality in cPanel & WHM version 76. For more information, read our Tomcat documentation.

xinetd

Restarts the open-source super-server daemon.

restorepkgRestores a package. For more information, read our The restorepkg Script documentation.
rpmupUpdates system software for all users.
runstatsonceUpdates statistics for all users.
runweblogsUpdates statistics for a user.
securemysqlSecures a cPanel account's MySQL® configuration. For more information, read our The securemysql Script documentation.
set_php_memory_limits

Adjusts the memory_limit directive for all versions of PHP installed in the /opt/cpanel/ directory based on the server's available memory. For more information, read WHM's  MultiPHP INI Editor  interface (WHM >> Home >> Software >> MultiPHP INI Editor) documentation. 

Notes:

  • This script only applies to systems that run EasyApache 4.
  • You must use the --run flag.
set-tls-settingsConfigures a server's Secure Socket Layer (SSL) and Transport Layer Security (TLS) cipher suites and protocols for the following services:
  • Web Disk (cpdavd).
  • The cPanel server (cpsrvd).
  • The Dovecot mail server (dovecot).

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

setupftpserverAllows you to switch between FTP servers.
setup_greylist_dbCreates the greylist SQLite database and allows you to add common email services to the trusted hosts list.
setup_modsec_dbCreates the modsec MySQL database and user.
setupmailserver

Allows you to switch between mail servers.

Important:

We removed the Courier mail server in cPanel & WHM version 54. cPanel & WHM only ships with the Dovecot mail server.

setupnameserverAllows you to switch between DNS servers.
slurp_exim_mainlogImports exim mainlog data into the eximstats database.
suspendacctSuspends an account.
try-laterExecutes 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. You can use this script with the following options:

--at

Allows you to specify a delay (in an interval other than minutes) after which to run the check and action commands. If you set this option, then the try-later command will pass directly to the at command. To learn more about the at command, visit its man page.

--action

Runs when the check command succeeds.

--act-finally

Runs the action command when retries are exhausted.

--check

Determines whether the action command will run.

--delay

Allows you to specify a delay (in minutes) after which to run the check and action commands. This value defaults to 5. If you set this option, then it overrides the --at option.

--help

Displays a brief help message.

--max-retries

Allows you to specify the maximum number of retry attempts before you run the action command. This value defaults to unlimited.

--skip-first

Skips the initial check command.
uninstall_pluginUninstalls a cPanel plugin. For more information, read our Uninstall Plugins documentation.
unlink_service_account

Restores a service account to an unlinked state.

Note:

For more information, run the following command:

/scripts/unlink_service_account --help

unsuspendacctUnsuspends an account.
*upUpdates a service. We currently provide several scripts that use this format to update a service.

cpaddonsup

Updates the cPAddons scripts.

phpup

Updates the current version of PHP.

suphpup

Updates the suPHP tool to handle PHP requests.
upcp

Updates cPanel & WHM.

Note:

When you use the --force option, the system executes the yum clean all command before it runs the  yum update command.

upcp-runningSpecifies whether a upcp command runs. This information displays in text output and the script's exit value. By default, a zero exit value signals that the target upcp command currently runs.

--help

Displays a brief help message.

--invert-exit

Exits with a non-zero error value (1) if the target upcp command currently runs.
upgrade_subaccount_databases

Verifies and upgrades the Subaccount database table schemas for each cPanel account.

Note:

For more information, run the following command:

/usr/local/cpanel/scripts/upgrade_subaccount_databases --help
wwwacctAdds a cPanel account. For more information, read our The wwwacct Script documentation

Additional documentation