Thursday 24 October 2013

How to Fix an (errno: 24) in MySQL


When creating a large number of partitions or tables, MySQL may mysteriously stop working and you find this type of error on /var/lib/mysql/hostname.err:

[ERROR] /usr/sbin/mysqld: Can't open file: './database/table.frm' (errno: 24)

errno: 24 simply means that too many files are open for the given process.
There is a read-only mysql variable called open_files_limit that will show how many open files are allowed by the mysqld:

SHOW VARIABLES LIKE 'open%';

 A lot systems set this to something very low, like 1024. Unfortunately, the following will NOT work: SET open_files_limit=100000

[mysqld]
open_files_limit = 100000

Then, be sure to restart mysql:

 /etc/init.d/mysql restart

Now, SHOW VARIABLES LIKE 'open%' should show 100000. The number you use may be different.

ERROR 2006 (HY000) at line 149351: MySQL server has gone away


I get this error while I was trying to import a Mysql dump file.

In order to solve this issue :

Locate and edit the my.cnf file your server is currently using.

In the [mysqld] section alter the max_allowed_packet settings to something like 

[mysqld] 
max_allowed_packet=32M 

After Altering the configuration file, restart the mysql server.
 

 

 


Finding the Inode usage of a Cpanel account 


Go to /home/username and execute the following command :

---------------------------------------------------------------------------------------------------------------------------
echo "Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
-------------------------------------------------------------------------------------------------------------------------------

Sample output
=================

root@server [~]# cd ~chereenm/

root@server [/home/chereenm]# echo "Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

Inode usage for: /home/chereenm
12 - .cagefs
 1 - .cagefs.cron
1 - .cagefs.screen
 2 - .cagefs.tmp
2 - .cl.selector
2 - .cpaddons
 40 - .cpanel
17 - etc
1 - .htpasswds
401 - mail
3 - .mozilla
2 - public_ftp
182 - public_html
3 - .spamassassin
190 - tmp
Total: 871

root@server [/home/chereenm]#
-------------------------------------------------------------------

Script to Change the Passwords of all Cpanel Accounts


Copy and paste the following into the file.
 
==========
#! /bin/bash
ls -1 /var/cpanel/users | while read user; do
pass=`</dev/urandom tr -dc “A-Za-z0-9*-/+.*=_\|\\#” | head -c16
echo “$user $pass” >> new-pass.txt
/scripts/realchpass $user  $pass
/scripts/ftpupdate
done
==========
 
Give execute permission to the file.
chmod +x changepass.sh
Execute
sh changepass.sh



Changing the timestamp on email clients


SquirrelMail
===========

Go inside the webmail program and click Options at the top.

Click the first link called Personal Information.

Under Timezone Options, look for "Your current timezone:" Change the drop down   to your time zone.

Click the Submit button.


Horde
======

 Go inside the webmail program and click Options at the top.

Click the second link called Locale and Time. Look for "Your current time zone:"

Change the drop down to your time zone.

Click the Save Options button.


RoundCube
==========

Go inside the webmail program and click Personal Settings at the top right.

Under User Interface, look for "Time zone"

Change the drop down to your time zone.

Click the Save button.


Outlook 2007
===========

At any time, you can change the time zone in Outlook so that it matches your current geographic location. Please consult the Outlook Help menu for assistance with other versions

On the Tools menu, click Options. Click Calendar Options.

Click Time Zone.

Under Current time zone, type a name for the current time zone in the Label box. In the Time zone list, click the time zone that you want to use.

 If you want your computer clock to automatically adjust for daylight saving time (DST) changes, select the Adjust for daylight saving time check box. This option is available only in time zones that use daylight saving time (DST).

 Click OK and you are done.


Thunderbird
===========

A Mozilla application has no clock of its own. It uses your system clock. Your system clock is controlled by your operating system settings.


Difference between ports 465 and 587


 Port 465 is for smtps - SSL encryption is started automatically before any SMTP level communication. 

Port 587 is for msa - it is almost like standard SMTP port. SSL encryption may be started by STARTTLS command at SMTP level if server supports it. Standard SMTP port accepts email from other mail servers without authentication. MSA should accept email after authentication (SMTP AUTH). It helps to stop outgoing spam when netmasters of DUL ranges can block outgoing connections to SMTP port.

 

 




Tuesday 15 October 2013

SMTP Error (-1): Connection to server failed

When trying to send emails from Roundcube,Horde and SquirrelMail if you are receving the error as follows :

-------------------------------------------------------------------
SMTP Error (-1): Connection to server failed
--------------------------------------------------------------------

This error is typically seen due to a setting in the CSF firewall or another firewall. It might be caused by having the following set :

SMTP_BLOCK = 1
SMTP_ALLOWLOCAL = 0

You would need to change SMTP_ALLOWLOCAL to 1 to enable webmail to function.