The following articles were authored by admin

command to find no of files on a folder in linux OS

How to find the no of files on a particular folder

ls -l | wc -l

Say If you want to find a specific files nos, You can use the below command.

for eg. you want to find .gz files

ls *.gz -l | wc -l

installing fantastico on linux with CPANEL

Login to the SSH with the root password.
Change to directory >> CGI

cd /usr/local/cpanel/whostmgr/docroot/cgi

wget -N http://www.netenberg.com/files/free/fantastico_whm_admin.tgz

tar -xzpf fantastico_whm_admin.tgz

rm -rf fantastico_whm_admin.tgz

Login to WHM, and follow the link WHM -> Add-Ons -> Fantastico De Luxe WHM Admin.

enabling time zone on your website

Some host, does not enable the timezone globally,

dont worry, There is a work account.

You can simply enable it bycreating a php.ini file on the current working directory

And put the below line and save it

date.timezone = “US/Central”
or
what ever the time zone which you want to be enabled on the website.

Transferring MySQL to another location then /VAR

How to Change the location of MySQL:

1) Stop MySQL using command: service mysql stop
2) cp /var/lib/mysql /home/mysql
3) pico /etc/my.cnf

remove everything in the file and replace with the following:

[mysqld]
set-variable = max_connections=500
pid-file = /home/mysql/mysqld.pid
socket = /var/lib/mysql/mysql.sock
skip-locking
safe-show-database
skip-bdb
old_passwords=1
long_query_time=2
log-slow-queries=/var/log/mysql-slow-queries.log
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_user_connections=50
max_connections=500
thread_cache_size=256
table_cache=8192
key_buffer=64M
max_connect_errors=20
max_allowed_packet=128M
join_buffer=2M
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
read_rnd_buffer_size=1M
thread_concurrency=16
myisam_sort_buffer_size=64M

the hit ctrl+x and save the file

4) chown -R mysql:mysql /home/mysql
5) rm /tmp/mysql.sock
6) ln -s ../../home/mysql/mysql.sock /tmp/mysql.sock
7) Run Command: service mysql restart

Now MySQL should be successfully started and operating from the location /home/mysql

You can remove the old mysql directory by using rm -rf /var/lib/mysql

how to find the no of connections from an IP

In, Linux Servers.

Login as root and use the below command to find the no of connections from an IP Address.

netstat -an | sort -k 4 | grep :80 | awk ‘{print $5}’ | sed -e s/’:.*’/”/g | sort | uniq -c | sort -k 1 -nr | head -n 20

How to flush DNS on linux OS ubuntu/mint

Open a terminal window and type the below command

sudo /etc/init.d/dns-clean start

You will be asked to enter the root password to complete the process.

finding Spammers on linux servers

Recently I came across an article by config server, though of sharing please refer the URL/link Finding the Spammers on Linux/WHM servers

Some very usefull windows plesk hosting controlpanel commands

Some very usefull windows plesk hosting controlpanel commands

websrvmng –reconfigure-vhost –vhost-name=yourdomain.com

Run Statistics Manually:

%plesk_bin%/statistics.exe

Re-build MailEnable according to Plesk DB:

mchk.exe –all –fix=all

Remove site from IIS:
websrvmng –remove-vhost –vhost-name=domainname.com

Re-create Domain in IIS according to Plesk DB:
websrvmng –reconfigure-vhost –vhost-name=domainname.com
or
websrvmng –reconfigure-all

Reset IUSR passwords (if sites are prompting for password)
websrvmng –update-anon-passwords-all

webmail (404s) issues Fix
“%plesk_bin%\defpackagemng.exe” –fix –type=webmail

For dnsmng related errors:
“%plesk_bin%\defpackagemng.exe” –fix –type=dnsserver

“%plesk_bin%\DNSMng.exe” update *

issue on suspending & unsuspending the hosting accounts in Windows Plesk

When you try suspending an account in windows plesk, you would get the below error message

ERROR: PleskUserException
Unable to activate/deactivate domain: Execute ftpmng --remove-vhost "--vhost-name=yourdomain.com" failed:
Execute ftpmng --reconfigure-all failed:

Additionally, an exception has occurred while trying to report this error: PleskFatalException
Execute ftpmng --remove-vhost "--vhost-name=yourdomain.com" failed:
Execute ftpmng --reconfigure-all failed:

0: DomainToggleUIPointer.php:28
DomainToggleUIPointer->disableDomain(object of type BsDomain)
1: client.domain.toggle.php:44
plesk__client__domain__toggle->accessItem(string 'GET', NULL null)
2: UIPointer.php:601
UIPointer->access(string 'GET')
3: plesk.php:43

Creating a send mail alert if load is high in server with w,pstree,mysqladmin results

Use the Below and code and save it in your root folder and add a cron to run in your server.

Replace name@yourdomain.com to your email-id and remove # before the email-id.

#!/bin/bash
#This script will send mail alert if load is high in server with w,pstree,mysqladmin results

#Enter The Email address
#email="name@yourdomain.com"

#Enter the Load Average
critical_load=15

current_load=`cat /proc/loadavg |awk '{print $2 }' |cut -d"." -f1 `

if [ $current_load -ge $critical_load=15 ]
then

cd /tmp
touch load.txt

#Enter the Text that you needs to dispaly on mail

echo "Please check the Server and reduce the Load" >> /tmp/load.txt
echo

echo  "LOAD STATUS RUN ON" `date` >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

echo " W Results  " >> /tmp/load.txt

w >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

echo "PSTREE Results" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

pstree -apu >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt
echo "MYSQLADMIN Results" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

mysqladmin proc >> /tmp/load.txt

echo "*******************" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

echo "NETSTAT RESULTS (FOR CHKING DDOS ATTACK..10 HIGH HTTP CONNECTIONS ) " >>/tmp/load.txt

echo >>/load.txt
netstat -plan |grep :80 | awk '{print $5}' |cut -d: -f1 |sort |uniq -c |sort -n |tail -10 >>/tmp/load.txt

echo "*******************" >> /tmp/load.txt
echo "*******************" >> /tmp/load.txt

mail -s "!!!Urgent HIGH LOAD Avg=$current_load in  $HOSTNAME " $email < /tmp/load.txt

>/tmp/load.txt

fi