Latest blog entry

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.

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

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 on cpanel: mysql database size 0MB

qmail-inject: fatal: mail server permanently rejected message

June 21, 2010    |   Posted by admin   |    Category: Plesk Management

You may notice “qmail-inject: fatal: mail server permanently rejected message” error message while sending emails from a Plesk server

qmail-queue-handlers[xxxx]: Unable to change group ID: Operation
not permitted
qmail-queue[xxxx]: files: write buf 0xbff4dfe0[156] to fd (5)
error - (32) Broken pipe
qmail-queue[xxxx]: files: cannot write chuck from 4 to 5 - (32)
Broken pipe

The reason is the incorrect permission and/or ownership of the ‘qmail-queue’ file under the /var/qmail/bin directory.

To fix the issue, you need to make sure the ownership of theĀ qmail-queue file is mhandlers-user:popuser and the permission are 2511.

To check the current ownership and permission of the file, execute:

# ls -la /var/qmail/bin/qmail-queue

It should be as follows:

-r-x--s--x 1 mhandlers-user popuser May 4 /var/qmail/bin/qmail-queue

If not, correct the ownership

# chown mhandlers-user.popuser /var/qmail/bin/qmail-queue

set the proper permissions,

# chmod 2511 /var/qmail/bin/qmail-queue

Restart the qmail service and the emails will work.

Comments Off on qmail-inject: fatal: mail server permanently rejected message

vzquota : (error) Quota on syscall for xxx: Device or resource busy

June 17, 2010    |   Posted by admin   |    Category: VPS Management

While starting a VPS, you may receive a “vzquota Device or resource busy” message as follows

# vzctl start VEID
 vzquota : (error) Quota syscall for id xxx: Device or resource busy
 vzquota : (error) Possible reasons:
 vzquota : (error) - Container's root is already mounted
 vzquota : (error) - there are opened files inside Container's
 private area
 vzquota : (error) your current working directory is inside
 Container's private area
 vzquota : (error) Use -v option to see currently opened file(s).
 Running vzquota on failed for Container xxx

The error message indicates 2 things:

1) There are some open files inside the Containers private area. To list those open files, execute

lsof 2> /dev/null | egrep '/vz/root/xxx|/vz/private/xxx'

where, xxx is the VPS ID. If the open files are listed, close them and start the VPS.

2) The second reason is you are in the containers private directory while starting the VPS. i.e. the private area of the VPS is /vz/private/xxx and your current working directory while starting the VPS is inside /vz/private/xxx.

Check the current working directory:

# pwd

if the output is something like /vz/private/veid, get out of the private directory and start the container

# cd
# vzctl start veid
Comments Off on vzquota : (error) Quota on syscall for xxx: Device or resource busy

Error: Unable to execute bash: No such file or directory

June 12, 2010    |   Posted by admin   |    Category: VPS Management

You may receive “Unable to execute bash: No such file or directory” error message while starting a VPS and the reason is either the binaries from /bin OR /usr/bin are missing OR corrupted.

To fix the issue, you either copy the directories /bin and /usr/bin from a working VPS OR from the OS template the VPS is using.

Solutions:
1) Copy directories from a working VPS:

cp -pR /vz/private/VEID1/fs/root/bin /vz/private/VEID/fs/root/
cp -pR /vz/private/VEID1/fs/root/usr/bin /vz/private/VEID/fs/root/usr/

where,
VEID1 is the working VPS
VEID is the VPS having problems.

2) Copy directories from the OS template. The OS templates are stored under /vz/template/cache directory.

a) Extract the template file the VPS is using

# cd /vz/template/cache/
# tar -zxf os-templatename.tar.gz

b) Copy the directories to the VPS private area

cp -pR /vz/template/cache/root/bin /vz/private/VEID/fs/root/
cp -pR /vz/template/cache/root/usr/bin /vz/private/VEID/fs/root/usr/

Once copied, make sure you are out of the VPS private area and restart the VPS.

# vzctl start VEID

It will re-calculate the quota of the VPS and will start the VPS.

Comments Off on Error: Unable to execute bash: No such file or directory