If you are getting error cpanel license expired or failed, than please run following command from root level.
/usr/local/cpanel/cpkeycltAfter the script runs, the command line will display no messages if your license works properly. If the script requires more than a few seconds to run, you may have connectivity issues.

