How to assign a dedicated IP to a Sub-domain OR Add-on/Park domain?

March 8, 2011    |   Posted by admin   |    Category: cPanel Management

By default, cPanel allows one IP per account, however, in case you wish to assign multiple IPs to an account, say for a sub-domain, you can do so by editing a few files. Follow the below steps:

1) The main configuration file of a domain is stored under the /var/cpanel/userdata/<username>/ directory, so edit the subdomain related file under it

# vi /var/cpanel/userdata/<username>/subdomain.domain.tld

Change the value of “IP” to a dedicated IP and save the file. The add-on and Park domains have their related subdomain files in the same directory.

2) Now, rebuild the Apache configuration for the changes to take affect in the respective VirtualHost entry

# /scripts/rebuildhttpdconf 

3) Restart the Apache webserver

# service httpd restart

4) Add the dedicated IP and sub-domain in the /etc/domainips file to mark the dedicated IP as assigned so WHM won’t be able to assign it to other domains.

dedicatedIP: subdomain.domain.tld

Save the file and rebuild the IP pool

# /scripts/rebuildippool

5) Now, edit the DNS zone file of the main domain (i.e. the domain under which the sub-domain is created) and add an ‘A’ record for the sub-domain to point to the new IP.

# vi /var/named/domain.tld.db

Save the file and restart the ‘named’ service

# service named restart

Allow sometime for the new IP to propagate.

Note: Rebuilding the IP pool will still list the IP as free under the WHM -> IP Function -> ‘Show IP Address Usage’, however WHM wont allow you to assign that IP to another domain.

How to add Domainkeys for a domain on a cPanel server?

November 29, 2010    |   Posted by admin   |    Category: cPanel Management

“DomainKeys” is an anti-spam software application that uses a public key, cryptography to authenticate the sender’s domain. cPanel offers a installer script “domain_keys_installer” using which the DomainKeys can be created and added automatically for a domain.

By default the DomainKeys is not added when the account is created on the server, it has to be added manually. SSH to your server and execute:

/usr/local/cpanel/bin/domain_keys_installer <username>

where, <username> is the username of the domain.

The DomainKey is automatically added in the DNS zone file of the domain located at /var/named/domainname.db file. To add DomainKeys for the existing domains, execute the following command as it is:

for i in `cat /etc/trueuserdomains | awk '{print $2}'`
do
/usr/local/cpanel/bin/domain_keys_installer $i;
done;

NOTE: If you are using a 3rd party name servers for your domain, you will have to add the DomainKeys in the DNS zone of your domain created on their servers.

tailwatchd failed: A restart was attempted automagically

September 24, 2010    |   Posted by admin   |    Category: cPanel Management

An email from a cPanel server with the “tailwatchd failed” warning message indicates that either the cpanel service is offline/down OR the cpanel service was restarted. The complete message looks like the following:

tailwatchd failed @ Tue Jan 1 00:00:00 2010. 
A restart was attempted automagically 
Service Check Method: [check command] tailwatchd is not running

There isn’t anything to worry, however, you can check the tailwatchd logs for the failure reasons:

# tail -f /usr/local/cpanel/logs/tailwatchd_log

To check the status of the ‘tailwatchd’ service and it’s output, execute

# /usr/local/cpanel/libexec/tailwatchd --status 
 Driver (Active: 1) Cpanel::TailWatch::ChkServd
 tailwatchd is enabled
 Running, PID 24463
 Driver (Active: 1) Cpanel::TailWatch::cPBandwd
 Driver (Active: 1) Cpanel::TailWatch::Antirelayd
 Driver (Active: 1) Cpanel::TailWatch::Eximstats

Restart the ‘cpanel’ service once, just to make sure it’s online

# service cpanel restart

and if you still continue to receive the ‘tailwatchd failed’ emails, update “cPanel” on the server

# /scripts/upcp --force

How to monitor and auto restart cron service using cPanel chkservd?

June 29, 2010    |   Posted by admin   |    Category: cPanel Management

Sometimes it is necessary to monitor a crond service itself on a cPanel server. cPanel offers ‘chkservd’ (a monitoring daemon) that monitors the services that are included in it and restarts them if they are found offline.

However, cPanel do not provide an option to include the ‘crond’ service under chkservd. The following method can be used to add crond service under chkservd.

Create a crond file under the chkservd.d directory where the files of all the services are placed:

# pico /etc/chkserv.d/crond

Add the following and save the file:

service[crond]=x,x,x,/etc/init.d/crond restart,crond,root

Now you need to edit the chkservd configuration file and enable the crond service for monitoring

# pico /etc/chkserv.d/chkservd.conf

add the following line at the end of the file

crond:1

Now, save the file and restart the chkservd service for the new changes to take affect:

# /scripts/restartsrv chkservd

In order to verify if chkservd auto-restarts the crond service if it is offline, stop the service manually

# service crond stop

and watch the chkservd logs

# tail -f /var/log/chkservd.log

You will notice that the crond service is restarted automatically within 5 minutes.

cpanel: mysql database size 0MB

June 27, 2010    |   Posted by admin   |    Category: cPanel Management

cPanel sometimes displays the mysql database size as 0MB in the Mysql Databases section of a client and the reason is the database cache file of the user is not updated.

To make sure cPanel displays the correct database size, follow the below steps:

1) SSH to the server and edit the cpanel.config file

# pico /var/cpanel/cpanel.config

search for

disk_usage_include_sqldbs=0

and change to

disk_usage_include_sqldbs=1

If the parameter is not present, add it. Save the file and execute the following command:

# /scripts/update_db_cache

OR

2) Login to the WHM, goto SQL section under Tweak Settings and enable the following option:

When displaying disk usage in cpanel/WHM include Postgresql and MySQL.

This will fix the issue.

Comments Off