cPanel – Can’t change hostname

While setting hostname from WHM  >>  Change Hostname
We were seeing below error
“The hostname was already set to, syncing configuration only.
Error setting new hostname: Could not execute hostname binary
Could not set property: Connection timed out”
After googling found a alternate solution to this via cli
The command was   /usr/local/cpanel/bin/set_hostname  <hostname>

It would and could change hostname 🙂