Skip to main content

Useful cPanel Scripts

This article covers some useful scripts built into cPanel!

cPanel Update

  • This script will check for any discrepancies between your current cPanel installation and the most recent update. After running the script, this should fix any issues with any corrupt or missing cPanel installation files, and can resolve a wide variety of issues that you may encounter in cPanel. Keep in mind, that this script can take a while to run, so you will likely want to only run a cPanel update during off-peak hours. cPanel updates generally run automatically around midnight.

    /scripts/upcp

    ℹ️ You can also force and upcp, which will do a clean update of cpanel:

    /scripts/upcp --force

Packaging and Restoring Accounts

  • cPanel has a script to package accounts into a .tar.gz file if you ever want to easily create a manual backup for one of your account, from your home directory simply run:

    /scripts/pkgacct [USER]  
  • If you wish to restore an account, you can use the following script:

    /scripts/restorepkg [USER]  
  • The above command will grab a backup for the user from the home directory, however, there may be times where  you need to define a specific backup you wish to restore from, you can do this by putting the file path to the backup after the user name:

    /scripts/restorepkg [USER] /path/to/backup.tar.gz  

Statistics and Quotas

  • This script will run statistics for all accounts on the server if you wish to have them updated immediately:

    /scripts/runstatsonce

    ⚠️ This script can take a while to run, so you will likely want to only run during off-peak hours.

  • If you want to run stats for a single user, you can run the following:

    /scripts/runweblogs [USER]  
  • And finally, if you are seeing any issues or discrepancies with quotas or statistics, this script can resolve some issues:

    /scripts/fixquotas  

    ⚠️ Once again, this script can take a while to run, so you will likely want to only run during off-peak hours.

Service Updates

Sometimes you may wish to update a specific service if you are encountering a problem, the following scripts can be used to update a few common services:

  • Updates the courier mail server

    /scripts/courierup 
  • Updates the dovecot mail server

    /scripts/dovecotup
  • Updates the exim mail exchanger

    /scripts/eximup 
  • Updates the FTP servers (proFTP and pure-FTP)

    /scripts/ftpup 

Restarting Services

Finally, sometimes if you are encountering an issue with a service, all it requires is a simple reboot. Here is a list of some common commands for restarting services.

  • This will restart the Apache service

    service httpd restart
  • This will restart the MySQL service

    service mysql restart
  • Restart the FTP server if you are running pure-FTP

    service pureftpd restart
  • Restart the FTP server if you are running proFTP

    service proftpd restart
  • Restart the Mail server if you are running Courier

    service courier restart
  • Restart the Mail server if you are running Dovecot

    service dovecot restart 
  • Restart the Exim mail exchanger

    service exim restart