# cPanel /scripts Commands: upcp, Licence Refresh, Package Repair and Service Restarts (cPanel 138)

Source: https://srvscripts.com/guides/cpanel-scripts-commands-upcp-license/
Updated: 2026-10-17
Publisher: srvScripts (https://srvscripts.com/)

These are the cPanel scripts (in /scripts and /usr/local/cpanel) that server admins use most, each run and checked on cPanel & WHM 138.

**Short answer:**

In short: cPanel scripts checked on cPanel 138: upcp (--force, --sync), cpkeyclt licence refresh, check_cpanel_pkgs, restartsrv_* and scripts that are gone.

- **Version:** `/usr/local/cpanel/cpanel -V`.

- **Refresh the licence:** `/usr/local/cpanel/cpkeyclt`.

- **Update:** `/usr/local/cpanel/scripts/upcp`. Add `--force` to reinstall the current version, or `--sync` to repair without upgrading.

- **Check and repair cPanel’s own packages:** `scripts/check_cpanel_pkgs --list-only`, then `--fix`.

- **Restart a service the cPanel way:** `scripts/restartsrv_SERVICE`.

`/scripts` is a link to `/usr/local/cpanel/scripts`, so `/scripts/upcp` also works.

We checked every script on this page on our cPanel lab server (cPanel & WHM 138.0 build 15, RELEASE tier, AlmaLinux 9.8) on 11 October 2026. We confirmed each one exists, read its `--help`, and ran the read-only and safe ones: the version, `cpkeyclt`, `check_cpanel_pkgs --list-only`, `restartsrv_exim --status`, `whoowns` and `check_unreliable_resolvers`. We did not run `upcp --force`, `--fix` or the account scripts, because they change the server.

## Careful: some scripts ignore --help and just run

Before you type `--help` after an unfamiliar cPanel script, know that several of them do not understand it and simply do their job. On our cPanel 138 lab:

- `cleanupmysqlprivs` started removing MySQL privileges (`UPDATE user SET Create_priv='N' ...`). On MariaDB 10.4 and later `mysql.user` is a view, so it stopped at the first statement with `ERROR 1356` and changed nothing. On an old MySQL it would have changed users’ rights. Do not run it on a modern server.

- `updateuserdomains` and `fix-cpanel-perl` ran without printing anything.

- `autorepair` tried to download a repair named `--help` from cPanel and failed.

Read the script first (`less /usr/local/cpanel/scripts/NAME`) or check cPanel’s documentation before running anything you do not know.

## Version and licence

```
/usr/local/cpanel/cpanel -V          # 138.0 (build 15)
/usr/local/cpanel/cpkeyclt           # Updating cPanel license...Done. Update succeeded.
ls -l /usr/local/cpanel/cpanel.lisc  # the licence file cpkeyclt refreshes
```

`cpkeyclt` asks cPanel’s licence server again, which fixes most “licence invalid” messages after an IP change or a renewal. If it fails, see [“cPanel license is invalid”: troubleshooting](/guides/cpanel-license-is-invalid/).

## Update cPanel: upcp

```
/usr/local/cpanel/scripts/upcp              # update according to /etc/cpupdate.conf
/usr/local/cpanel/scripts/upcp --force      # reinstall even if up to date
/usr/local/cpanel/scripts/upcp --sync       # repair the installed version, no upgrade (not with --force)
/usr/local/cpanel/scripts/upcp --bg         # run in the background; output only in the log
/usr/local/cpanel/scripts/upcp --security   # only expedited security updates (also runs hourly from cron)
```

These options come from `upcp --help` on cPanel 138. `--security` is new: it applies a security release for your current major version, and packages that cPanel has flagged as security fixes. It follows `SECURITY_UPDATES` and `RPMUP` in `/etc/cpupdate.conf` and does nothing when there is nothing to apply. `--cron` makes a run follow WHM’s Update Preferences. The settings file on our lab:

```
CPANEL=release
RPMUP=daily
SARULESUP=daily
SECURITY_UPDATES=hourly
STAGING_DIR=/usr/local/cpanel
UPDATES=daily
```

Logs are in `/var/cpanel/updatelogs/`. Choosing a tier: [LTS 134, RELEASE 138 or STABLE](/guides/cpanel-update-tier-lts-134-release-138/). When upcp fails: [upcp failed: upgrade blocked](/guides/cpanel-upcp-failed-upgrade-blocked/).

## Check and repair cPanel’s packages

```
/usr/local/cpanel/scripts/check_cpanel_pkgs --list-only     # list altered or missing cPanel packages
/usr/local/cpanel/scripts/check_cpanel_pkgs --long-list     # the same, with the altered files
/usr/local/cpanel/scripts/check_cpanel_pkgs --fix           # reinstall the affected packages
```

It checks cPanel-managed packages for changed ownership, MD5 mismatches, wrong symlinks and packages that should or should not be installed. On our lab, `--list-only` took 17 seconds, printed nothing and exited 0, which means everything was intact. `--targets` limits the check to some packages, and `--no-digest` speeds it up by skipping the checksum check.

## Restart services: restartsrv_*

```
/usr/local/cpanel/scripts/restartsrv_httpd             # soft restart (default)
/usr/local/cpanel/scripts/restartsrv_httpd --graceful
/usr/local/cpanel/scripts/restartsrv_httpd --hard      # skip the soft restart
/usr/local/cpanel/scripts/restartsrv_exim --status     # is it running? (also the exit code)
/usr/local/cpanel/scripts/restartsrv_dovecot --stop
```

cPanel 138 on our lab has 46 `restartsrv_` scripts, including `apache_php_fpm`, `cpsrvd`, `cphulkd`, `dovecot`, `exim`, `ftpd`, `httpd`, `mysql`, `named`, `pdns` and `postgresql`. List them with `ls /usr/local/cpanel/scripts/restartsrv_*`. Prefer these over `systemctl restart` on cPanel servers: they use cPanel’s own service handling and support the soft and graceful restarts shown above.

## Accounts and ownership

| Script | What it does | Note |
| --- | --- | --- |
| whoowns DOMAIN | Prints the cPanel user that owns a domain | Ran it: site1 |
| pkgacct USER / restorepkg FILE | Back up / restore one account | See pkgacct and restorepkg |
| wwwacct DOMAIN USER PASS ... | Create an account | Prefer whmapi1 createacct; wwwacct takes positional arguments |
| removeacct USER | Terminate an account | killacct does not exist on cPanel 138 |
| updateuserdomains | Rebuild the user/domain maps | Runs straight away, no prompt |
| modify_accounts | Change accounts’ theme or style | Read its --help |
| fixquotas | Recalculate disk quotas | See fixquotas repair |
| mailperm | Fix mail file permissions |  |
| rebuildhttpdconf | Rebuild the Apache configuration | Then restartsrv_httpd |
| cpbackup | Run the configured cPanel backup now |  |

## Other useful cPanel scripts and server roles

| Script | What it does |
| --- | --- |
| setupmailserver, setupftpserver, setupnameserver | Switch the mail, FTP or DNS server software |
| check_unreliable_resolvers | Tests the resolvers in /etc/resolv.conf (our lab: OK) |
| update_local_rpm_versions | Changes which package versions cPanel installs (advanced) |
| rebuild_whm_chrome | Rebuilds the WHM interface frame after plugin changes |
| convert_roundcube_mysql2sqlite | Moves Roundcube’s storage from MySQL to SQLite |

## Scripts that are gone

Old guides still mention scripts that do not exist on cPanel 138. On our lab these were missing:

- `killacct` (use `removeacct`)

- `rebuild_dns_config`

- `setupmysqlserver`

- `checkallsslcerts` (it moved to `/usr/local/cpanel/bin/checkallsslcerts`)

- `fixmailboxperms` (use `mailperm`)

- `migrate_ea3_to_ea4` and `makecpphp` (EasyApache 3 is long gone)

- `install_lets_encrypt_autossl_provider` and `rebuild_mailman_config`

Before you rely on a script from an old guide, check that it exists: `ls /usr/local/cpanel/scripts/NAME`.

Vendor reference: the [cPanel & WHM documentation](https://docs.cpanel.net/).

## Frequently asked questions

### How do I force a cPanel update?

Run /usr/local/cpanel/scripts/upcp --force as root. It reinstalls cPanel even if it is up to date. To repair the installed version without upgrading, use upcp --sync instead (the two cannot be combined).

### How do I refresh the cPanel licence from the command line?

Run /usr/local/cpanel/cpkeyclt as root. It prints Update succeeded when the licence server confirms the licence for the server’s IP.

### What does upcp --security do?

On cPanel 138 it applies expedited security updates only: a security release for the current major version and packages cPanel flagged as security fixes. It runs hourly from cron and follows SECURITY_UPDATES and RPMUP in /etc/cpupdate.conf.

### How do I check whether cPanel files were changed?

Run /usr/local/cpanel/scripts/check_cpanel_pkgs --list-only. It lists cPanel packages with changed files, ownership or symlinks. No output and exit code 0 means everything is intact; --fix reinstalls the affected packages.

### Is it safe to run a cPanel script with --help?

Not always. On cPanel 138, cleanupmysqlprivs, updateuserdomains, fix-cpanel-perl and autorepair ignore --help and start working. Read the script or the documentation first.
