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

Script to terminate suspended accounts on a cPanel server

June 7, 2010    |   Posted by admin   |    Category: Scripts

How to check suspended accounts on a cPanel server and terminate them after a specific time frame?

Many a times you suspend an account on the server and it goes unnoticed for months thus wasting disk space of your server. You can use the following script and schedule it to execute, say once in a day which will delete the suspended accounts from the server.

Create a file called terminatesuspended.sh

# pico /root/terminatesuspended.sh

Add the following code

for i in `find /var/cpanel/suspended/ -mtime +30 |\
  cut -d'/' -f5 | sed '1 d'` 
 do 
 y | /scripts/killacct $i;
 done;

The username of suspended accounts are saved under the /var/cpanel/suspended directory. The find command will search the /var/cpanel/suspended/ directory for files which are 30 days old and will pass the username to the ‘killacct’ command.

Save the file and set a cronjob to execute the file once in a day. Edit the root cronjob file

# crontab -e

Add the following cronjob

0 1 * * * /bin/sh /root/terminatesuspended.sh

The above cronjob will terminate the account that is been suspended from more than 30 days at 1.00AM.

Comments Off on Script to terminate suspended accounts on a cPanel server