Updated: 28 September 2026 · Applies to: cPanel & WHM version 138 on AlmaLinux, Rocky Linux, CloudLinux and Ubuntu servers

cPanel & WHM includes hundreds of command-line scripts in /usr/local/cpanel/scripts/ (the old /scripts path from earlier versions). They are useful when WHM is unreachable, for automation, and for tasks that are faster in a terminal. This page lists the scripts server administrators use most, each checked on a cPanel 138 server and described from cPanel's documentation. Many scripts from old lists online (FrontPage, FreeBSD and Apache 1.3 helpers) no longer exist.

Run these as root, and prefer WHM's own interface for anything you do rarely: scripts do not ask for confirmation.

Updates

  • /usr/local/cpanel/scripts/upcp: update cPanel & WHM now, according to your update settings. --bg runs it in the background and logs to /var/cpanel/updatelogs/; --force reinstalls all files, even when up to date.

Restart services

One script per service, named restartsrv_SERVICE:

/usr/local/cpanel/scripts/restartsrv_httpd      # Apache
/usr/local/cpanel/scripts/restartsrv_nginx      # NGINX (ea-nginx)
/usr/local/cpanel/scripts/restartsrv_mysql      # MySQL or MariaDB
/usr/local/cpanel/scripts/restartsrv_exim       # mail sending
/usr/local/cpanel/scripts/restartsrv_dovecot    # IMAP and POP3
/usr/local/cpanel/scripts/restartsrv_pdns       # PowerDNS
/usr/local/cpanel/scripts/restartsrv_cpsrvd     # cPanel and WHM web interfaces

Options include --check (is it running?), --graceful, --reload, --hard, --stop and --start. cPanel's documentation recommends these scripts when a service will not restart from WHM.

Accounts

  • /usr/local/cpanel/scripts/pkgacct USERNAME /home/backups: pack a full account into a cpmove-USERNAME.tar.gz archive, for backup or migration. --skiphomedir leaves out the home folder.
  • /usr/local/cpanel/scripts/restorepkg /home/backups/cpmove-USERNAME.tar.gz: restore an account from such an archive, on this or another cPanel server.
  • /usr/local/cpanel/scripts/wwwacct DOMAIN USERNAME PASSWORD: create an account (further options must be given in the documented order; the WHM API function createacct is easier to use in scripts).
  • /usr/local/cpanel/scripts/removeacct USERNAME: terminate an account and delete its data. This cannot be undone; take a pkgacct backup first.

Web server, SSL, DNS and backups

  • /usr/local/cpanel/scripts/rebuildhttpdconf: rebuild Apache's main configuration from cPanel's data. It does not restart Apache; run restartsrv_httpd afterwards. --preview writes a preview file instead.
  • /usr/local/cpanel/scripts/ea-nginx clear_cache USERNAME: clear the NGINX cache of one account when NGINX with caching is in use.
  • /usr/local/cpanel/bin/autossl_check --user=USERNAME: run an AutoSSL check for one account (or --all), to renew or troubleshoot free certificates.
  • /usr/local/cpanel/scripts/cleandns: remove orphaned and duplicate DNS zone entries.
  • /usr/local/cpanel/bin/backup: run the configured cPanel backup now. --force makes an additional backup even if up-to-date backups exist; --debug runs it in the foreground and shows its progress.

APIs for automation

For scripts of your own, the supported interface is the API, not internal scripts:

whmapi1 listaccts                      # WHM API 1, as root
uapi --user=USERNAME Email list_pops   # UAPI, on behalf of one account

Both commands are in /usr/local/cpanel/bin/ and print YAML by default (--output=json for JSON).

Prefer not to run these yourself? Our cPanel server management team handles updates, migrations and troubleshooting.

Official documentation: cPanel scripts documentation.

Was this answer helpful? 0 Users Found This Useful (0 Votes)