Key

This line was added.

This line was removed.

Formatting was changed.

Include Page

LIB:_Version

LIB:_Version

Table of Contents

style

none

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:

Code Block

language

bash

/usr/local/cpanel/scripts/upcp

Warning

title

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.

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

Note

title

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.

When the /usr/local/cpanel/scripts/maintenance script runs, the system adds the /usr/local/cpanel/scripts/clean_user_php_sessionsscript 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

title

Note:

For example, run the following command, where file1 and file2 represent the two files that you wish to compare:

Code Block

language

bash

/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.

Note

title

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.

Runs nightly and deletes messages from trash folders that are older than the Trash Expire Time value in WHM'sMailserver Configurationinterface (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

title

Note:

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

Code Block

language

bash

/usr/local/cpanel/scripts/dumpcdb file

easyapache

Upgrades and reinstalls Apache.

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).

Note

title

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.

find_and_fix_rpm_issues

Detects issues with your server's RPM database and rebuilds the database if problems exist. 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

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

title

Note:

Some cPAddons possess security-sensitive files, such as files that contain passwords in clear text. cPAddonsthat exist on servers that do not use thempm-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.

fixndc

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

Code Block

language

bash

linenumbers

true

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

Warning

title

Important:

You must run the /scripts/fixndc script twice.

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

exportmydnsdb

Exports zones from MyDNS for use with BIND and NSD.

fixmailinglistperms

Repairs permissions for all mailing list files and directories.

gather-update-logs

Sends update logs to cPanel, Inc. for analysis.

hook

Executes any hooks that the system would normally call in the specified context.

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.

Note

title

Notes:

This script only applies to systems that run EasyApache 4.

You must use the --run flag.

set-tls-settings

Configures a server's Secure Socket Layer (SSL) and Transport Layer Security (TLS) cipher suites and protocols for the following services:

Creates the greylist SQLite database and allows you to add common email services to the trusted hosts list.

setup_modsec_db

Creates the modsec MySQL database and user.

setupmailserver

Allows you to switch between mail servers.

Warning

title

Important:

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

setupnameserver

Allows you to switch between DNS servers.

slurp_exim_mainlog

Imports exim mainlog data into the eximstats database.

suspendacct

Suspends an account.

try-later

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. 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.

cPanel, WebHost Manager, and WHM are registered trademarks of cPanel, Inc. for providing its computer software that facilitates the management and configuration of Internet web servers. ®2018 All rights reserved.