Thursday, 7 November 2013

[Howto Fix] Table './eximstats/sends' is marked as crashed and should be repaired

mysql> repair table eximstats.sends;


mysqlcheck -u root --check auto-repair --optimize all-databases

How to check last reboot date and time in linux servers

You can check the last reboot date and time in linux servers by using the following commands.
# who -b
#last reboot

Command to check load in all the VPS in a nodes

vzlist -o hostname,laverage,veid

HOSTNAME         LAVERAGE       VEID

Redirect Rule not working

We faced an issue recently where a redirect rule was not working irrespective of correctly specifying in .htaccess file. We checked in several ways but the issue was not resolved. Finally, my fellow admin suggested we add it directly in the virtual host in apache config file of the domain. And it worked!!!!.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^webmail.yourdomainname.com
RewriteRule ^/(.*)$https://www.google.com/a/yourdomainname.com/$1  [L,R=301]

How to find max apache connections to a domain from IPs

You can use the following script to determine the IP/IPs from which maximum apache connections were made to the domain.

less /usr/local/apache/domlogs/domain.com | awk ‘{print $1}’ | sort | uniq -c | sort -n

use tcpdump command to check connections to port 80

You can use the following command to get the connections to port 80:
tcpdump -nn ‘tcp[13] == 2′ and port 80 -c 100 -i any

vzquota : (error) quota file is corrupted

If you get error “vzquota : (error) quota file is corrupted”

Use below commands,

# vzquota off 5000

vzquota : (error) quota file is corrupted

# vzquota drop  5000

# vzctl start 5000
Starting container …
Initializing quota …

Now wait for quota to get recreated