OpenVZ visualization environments have a a common problem with keeping the correct hostname on reboot, this will thus cause your cPanel license to fail and requires your hostname to be updated every reboot.

I have a simple solution:

A bash script to run on startup as a Service.

Sample Bash Script: cpanel-licence-update

#!/bin/sh
#update cpanel licence after reboot
#systemctl enable licence.service
cd ..
hostname server.domain.com
/usr/local/cpanel/cpkeyclt

hostname="${HOSTNAME}"
mail -s "Hostname Update" "info@domain.com" <<EOF
The hostname has been updated after a server reboot to: $hostname
This confirms cPanel Licence update.
EOF
exit 0

This script will then send a mail to confirm the update has completed.

Sample of Service File:  licence.service

[Unit]
Description=Update cPanel Licence

[Service]
Type=oneshot
ExecStart=/root/cpanel-licence-update

[Install]
WantedBy=multi-user.target

 

Putting it all together:

path to update #bash script               /root/cpanel-licence-update
path to #systemd service              /etc/systemd/system/licence.service

systemctl enable licence.service    # Enabling Service

systemctl daemon-reload                #reload systemctl

service licence status -l                    #check service status

 

You should successfully be able to reboot your CentOS 7 VM  without needed to manually reactivate cPanel licence.

Leave a Reply

Your email address will not be published. Required fields are marked *