Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 27 August 2014

How to clear eximstats db

If the your size of eximstats database is getting large, you can do the following steps to clear it.

Login to mysql

#mysql
mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

You can also use the following steps.
mysqladmin drop eximstats

mysqladmin create eximstats

mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

Monday, 28 July 2014

Update Nagios Plugins- ERROR "NRPE: Unable to read output"

Update the nagios plugins if you're getting the ERROR "NRPE: Unable to read output"

Do the below steps by login to the server by root.
# cd /usr/local/src/
# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
# tar -zxvf nagios-plugins-2.0.3.tar.gz
# cd nagios-plugins-2.0.3
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
# chown nagios:nagios /usr/local/nagios
# chown -R nagios:nagios /usr/local/nagios/libexec
# service xinetd restart
Use the below command to check the result from your nagios server.

# /usr/local/nagios/libexec/check_nrpe -H <server_IP> -c check_serviceName

Thats all.

Tuesday, 8 July 2014

Install cPanel on a Virtual Server Running Centos 6

cPanel
cPanel is a convenient application that allows users to administer servers through a GUI interface instead of the traditional command line. Although the installation for cPanel is relatively simple, the script does take several hours to run.


Note:
Once cPanel is installed, it cannot be removed from the server without a complete server restore. cPanel does not offer an uninstaller and cPanel is subject to a licensing fee

Setup

Before installing cPanel on our droplet, we need to take two additional steps.
  • First we need to make sure that Perl is installed on the server
# yum install perl
After installing perl we need to take one more preliminary step. cPanel is very picky about making sure that server that it is installed on has a Fully Qualified Domain Name. To that effect, we need to provide it with a valid hostname.
#hostname  host.example.com
Install cPanel

The cPanel installation only has several steps and the installation will take a long time. Although using program "screen" is not necessary in order to install cPanel, it can be a very helpful addition to the installation process. It can be especially useful if you know that you may have issues with intermittent internet or that you will need to pause the lengthy install process.

To start off, go ahead and install screen:

# yum install screen
Once screen is installed, start a new session running:

#screen -S cPanel
After opening screen, you can proceed to install cPanel with WHM or a DNS only version of cPanel.
 # cd /usr/local/src
  •  Use this this command to install cPanel with WHM:
#wget -N http://httpupdate.cPanel.net/latest
  • Use this command to install the DNS only version of cPanel:
#wget -N http://httpupdate.cPanel.net/latest-dnsonly
With the requested package downloaded, we can go ahead and start the script running:
#sh latest
Detach screen type by "Ctrl+a+d" combination key. The script, which may take one to two hours to complete will continue running while in the background,even if you close out the of server.

To reattach to your screen you can use the command:
#screen -r <Screen_ID
Once cPanel has finally installed, you can access the login by going to your https://ip_address:2087 or domain (https://example.com:2087)

From there, you can create your cpanel user and finally login in at ipaddress/cpanel or domain/cpanel.

Thats it. :-)


Tuesday, 1 July 2014

[FIX] A DNS entry for “Domain.com” already exists. You must remove this DNS entry from all servers in the DNS cluster to proceed.

If you getting the following ERROR while try to create a parked domain in your cPanel account.

"A DNS entry for “Domain.com” already exists. You must remove this DNS entry from all servers in the DNS cluster to proceed"
 Solution:

 Login to server through ssh and execute the following command.

# /scripts/killdns domain.com

After that try again to add. Hope you can add the domain as parked successfully :-)

You can check it through.

# grep -R domain.com /var/cpanel/userdata/*

You can see the list of subdomains and addon/parked domains from this file of the user.

# cat /var/cpanel/userdata/user_name/main

 Thats it.

Wednesday, 25 June 2014

[FIX] 403 forbidden error - pcfg_openfile: unable to check htaccess file, ensure it is readable

If you're getting the "403  forbidden error" while accessing your website.  This issue is generally due to permissions.

Step 1:

  • Check error log,

# tailf /usr/local/apache/logs/error_log | grep <Your IP/website name>
 You'll get below error,

 [Wed Jun 25 15:39:08 2014] [crit] [client XX.XX.XX.XX] (13)Permission denied: /home/user_name/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


Step 2:

  • Most often, setting folder permissions back to 755 should resolve this issue.
The default permissions for folders should be 755. When reviewing your account,I recommend setting these folders back to 755 and then testing again. If you have sub folders within those that are not 755, you'll want to adjust those as well.
  •  # chmod 755 /home/user_name
That's it.



Friday, 13 June 2014

cPanel logs for access, Apache, email, error, ftp, mysql, and WHM

cPanel logs
  • Access logs and user actions    /usr/local/cpanel/logs/access_log
  • Account transfers and misc. logs    /var/cpanel/logs
  • Auditing log (account creations, deletions, etc)    /var/cpanel/accounting.log
  • Backup logs    /usr/local/cpanel/logs/cpbackup
  • Brute force protection (cphulkd) log    /usr/local/cpanel/logs/cphulkd.log
  • Cpanel dnsadmin dns clustering daemon    /usr/local/cpanel/logs/dnsadmin_log
  • Cpanel taskqueue processing daemon    /usr/local/cpanel/logs/queueprocd.log
  • DBmapping    /usr/local/cpanel/logs/setupdbmap_log
  • EasyApache build logs    /usr/local/cpanel/logs/easy/apache/
  • Error log    /usr/local/cpanel/logs/error_log
  • Installation log    /var/log/cpanel
  • License updates and errors    /usr/local/cpanel/logs/license_log
  • Locale database modifications    /usr/local/cpanel/logs/build_locale_database_log
  • Login errors (CPSRVD)    /usr/local/cpanel/logs/login_log
  • Horde    /var/cpanel/horde/log/
  • RoundCube    /var/cpanel/roundcube/log/
  • SquirrelMail    /var/cpanel/squirrelmail/
  • Panic log    /usr/local/cpanel/logs/panic_log
  • Per account bandwidth history (Cached)    /var/cpanel/bandwidth.cache/{USERNAME}
  • Per account bandwidth history (Human Readable)    /var/cpanel/bandwidth/{USERNAME}
  • Service status logs    /var/log/chkservd.log
  • Tailwatch driver tailwatchd log    /usr/local/cpanel/logs/tailwatch_log
  • Update analysis reporting    /usr/local/cpanel/logs/updated_analysis/{TIMESTAMP}.log
  • Update (UPCP) log    /var/cpanel/updatelogs/updated.{TIMESTAMP}.log
  • WebDisk (CPDAVD)    /usr/local/cpanel/logs/cpdavd_error_log
  • Website statistics log    /usr/local/cpanel/logs/stats_log
cPanel access log
  • Access logs and user actions    /usr/local/cpanel/logs/access_log
cPanel apache log
  • Apache restarts done through cPanel and WHM    /usr/local/cpanel/logs/safeapcherestart_log
  • Domain access logs    /usr/local/apache/domlogs/{DOMAIN}
  • Processing of log splitting    /usr/local/cpanel/logs/splitlogs_log
  • suPHP audit log    /usr/local/apache/logs/suphp_log
  • Web server and CGI application error log    /usr/local/apache/logs/error_log

cPanel email log
  • Delivery and receipt log    /var/log/exim_mainlog
  • Incoming mail queue    /var/spool/exim/input/
  • Log of messages rejected based on ACLS or other policies    /var/log/exim_rejectlog
  • Unexpected/Fatal error log    /var/log/exim_paniclog
  • IMAP, POP login attempts, transactions, fatal errors and spam scoring    /var/log/maillog    /var/log/messages
  • Mailman    /usr/local/cpanel/3rdparty/mailmain/logs

MySQL log
  • MySQL error log    /var/lib/mysql/{SERVER_NAME}.err
  • MySQL slow query log (if enabled in my.cnf)    /var/log/slowqueries

[FIX] Reset Bandwidth Limit Exceeded user/domain

If domain is giving the error of “Bandwidth Limit Exceeded” you can Reset/Increase it from WHM or terminal as well.

From WHM :

To bring the website back online and reset the bandwidth exceeded, use the option.
  • WHM >> Account Functions >> Reset  Account Bandwidth Limit
This will reset the bandwidth usage to zero for the account. To increase the bandwidth limit for the account, use the option
  • WHM >> Account Information >> “View Bandwidth Usage”
From Terminal :
  • # vi /var/cpanel/users/USERNAME
change BWLIMIT (Increase the value)
  • # /scripts/updateuserdomains
  • # cd /var/cpanel/bandwidth.cache/
  • # vi domainname.com
Delete the numbers in that file and retype 0 instead of the number 
Save and quit and show bandwidth usage in WHM you will find its 0.

If the above steps doesn’t work well, use the below steps.
  • # cd /var/cpanel/bwlimited/
remove the files related to that user or domain
(or)
rename the fies with suffix _bk/.bak etc.
Example:
user_bk
domainname.com_bk
www.domainname.com_bk

 This will bring the website back online. :-)

Thursday, 12 June 2014

View Pidgin Chat Logs On Your Linux Terminal

If you want to look on your pidgin chat history/conversations in linux, you can easily find the logs in the below location.

# cd ~/.purple/logs/
 Pidgin’s chat logs (chat histories) are saved in HTML files. In the above path, you find more directories to what you actually need.

For example: A Jabber account with username stebu.johny@domain.com‘s log will be found in this path.

You can find various users that the user have chatted with.

Example:

darelegacy stebu.johny@domain.com # pwd
/home/darelegacy/.purple/logs/jabber/stebu.johny@domain.com
darelegacy stebu.johny@domain.com # ll
drwx------  2 darelegacy darelegacy  4096 Mar 18 05:03 abhijith.pm@domain.com
drwx------  2 darelegacy darelegacy  4096 Jun  6 13:55 abhilash@domain.com
drwx------  2 darelegacy darelegacy  4096 Apr 10 08:40 abin@domain.com
drwx------  2 darelegacy darelegacy  4096 Jun  3 13:07 ajay.joseph@domain.com
Go to the directories that you want to check the logs.

Example: 

 # cd abhijith.pm@domain.com

You'll get the log files for that user.

Example:
 -rw-r--r--  1 darelegacy darelegacy   912 Mar  5 07:21 2014-03-05.005451+0530IST.html
-rw-r--r--  1 darelegacy darelegacy  3404 Mar  7 06:47 2014-03-07.033705+0530IST.html
-rw-r--r--  1 darelegacy darelegacy 23804 Mar 18 05:14 2014-03-18.050323+0530IST.html
Open the .html log using the command below.
  # elinks -dump -dump-color-mode 1 <file>.html

Thats it. :-)




Saturday, 7 June 2014

Extract Images From Videos Using ffmpeg

If you want to extract images from a video file. You can use ffmpeg to get images from a video.

ffmpeg
ffmpeg is a very useful command line program which can be used to transcode media files. It is part of the FFmpeg leading multimedia framework that has many functionalities such as the ability to  decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.

There are many various tools included in the framework each of which has a specific role. For example the ffserver is used to stream multimedia for live broadcasts, ffprobe is used to analyze multimedia stream, ffplay can be used as a simple media player and ffmpeg has the ability to convert multimedia files between formats.
Steps:
 You need to install the ffmpeg command line utility in your linux machine for extracting images from the video file.

Ubuntu users can easily install the ffmpeg utility by typing and running the following command in their terminal.
  • sudo apt-get install ffmpeg
Fedora/Centos users can install ffmpeg directly from the repos.
  • yum install ffmpeg
After that,
  • cd /usr/local/src/wget http://www.ffmpeg.org/releases/ffmpeg-2.2.3.tar.bz2
  •  ./configure
  • tar -xvjf ffmpeg-2.2.3.tar.bz2
  •  cd ffmpeg-*
  • ./configure
Note: If the following error occurs,
yasm/nasm not found or too old. Use --disable-yasm for a crippled build.
 Execute the command below.
  • ./configure --disable-yasm
continue by compiling,
  •   make
Once the compile is finished run the following command to install ffmpeg.
  • su -c 'make install'
Note: Everything has been finished now, you have to type a few commands in your terminal and you will be able to extract images from any type of video file.

Before going any further make sure you are in the same directory with the video file from which you want to extract images from. Use the cd command to navigate to the right directory. Since the video I am using for the purpose of this tutorial is in my Desktop i use the following command to navigate to my desktop.

  • cd <file_location>

Then I use the following command to extract images from my video file.
  •  ffmpeg -i "Exapmle_video.mp4" -r 1 -q:v 2 -f image2 image-3%d.jpeg
The -i option serves to get the input which in my case is the video file named "Exapmle_video.mp4", the -r option sets the number of frames to be extracted as images every second. I like to extract one frame every second.

Then a very important option that should be mentioned and I like to use is the -q:v which is used to set the image quality of the images being extracted. I  always get high quality images when extracting them from a video by using the value of 2.

FFmpeg Basic Commands

Here is the list of few ffmepg basic commands list.

  • ffmpeg -version        :         show version
  • ffmpeg -formats       :         show available formats
  • ffmpeg -codecs         :        show available codecs
  • ffmpeg -decoders     :        show available decoders
  • ffmpeg -encoders     :        show available encoders
  • ffmpeg -bsfs             :        show available bit stream filters
  • ffmpeg -protocols    :        show available protocols
  • ffmpeg -filters          :        show available filters
  • ffmpeg -pix_fmts      :        show available pixel formats
  • ffmpeg -layouts        :        show standard channel layouts
  • ffmpeg -sample_fmts:        show available audio sample formats

Try it :-)

Wednesday, 4 June 2014

The uninstallation and installation procedures for Nginx and Apache webserver.


Step 1: Login to the server as root, Please refer the following commands

Installation of Nginx

  • cd /usr/local/src
  • wget http://nginxcp.com/latest/nginxadmin.tar(download stable release)
  • tar xf nginxadmin.tar
  • cd publicnginx
  • ./nginxinstaller install

Note: You may need to run the pythonfix script if you are installing it in first time.

As It's a major release so if you have previously installed the any version of the nginx, please uninstall and then perform the installation.

Uninstallation of Nginx

  • cd /usr/local/src
  • wget http://nginxcp.com/latest/nginxadmin.tar (download stable release)
  • tar xf nginxadmin.tar
  • cd publicnginx
  • ./nginxinstaller uninstall

Installation Apache server.


Please refer the following commands.

Step 1      : Download the latest stable release.

Step 2      : Extract the Apache Files.

Example  : gunzip -d httpd-2_0_NN. tar. gz
                  tar xvf httpd-2_0_NN.tar

Step 3      : Configuring Your Server for Apache.
                   ./configure

Step 4     : Build Apache.
                    make
                    make install

Step 5     : Customize Apache. (Configuration file edit ie, httpd.conf).

Step 6     : Restart httpd service.
                  service httpd restart

Inorder to unistall Apache.

We can use "yum" command by executing the command.

  • yum erase httpd --nodeps

Note: There is no need to remove httpd from the server, you may stop the httpd service permanently by executing the commands below.

  • service httpd stop
  • chkcfg httpd off

Please note that the packages for the server may differ according server configuration and it is strongly recommended to make sure all before proceeding.

Sunday, 1 June 2014

FIXED [Temporary Blocks: IP:X.X.XX.XXX Port: Dir:in TTL:3600 (lfd - *Port Scan* detected from X.X.XX.XXX ]

If you have getting following the error while checking IP block for the specific IP.

# csf -g <IP>
Temporary Blocks: IP:X.X.XX.XXX Port: Dir:in TTL:3600 (lfd - *Port Scan* detected from X.X.XX.XXX (KE/Kenya/X.X.XX.XXX.domain.com). 6 hits in the last 255 seconds)

Use the below command to remove temporary IP block from the CSF firewall.

Exapmle:

# csf -tr <IP>
DROP  all opt -- in !lo out *  X.X.XX.XXX  -> 0.0.0.0/0 
csf: X.X.XX.XXX temporary block removed
csf: There are no temporary IP allows





Friday, 21 February 2014

[FIXED]Exim Line Mismatch Error

While we try to delete mail from the Queue it showing "Line Mismatch Error" as below
root@mailserver [~]# exiqgrep  -f  "<>" -i| xargs exim -Mrm
Line mismatch: 5h 1Qmr1H-0005ql-So

If we try to delete that mail Id as below,Defenetely it will delete but may another mail id will occupies that place again.

Example:
  root@mailserver [~]# exim -Mrm 1Qmr1H-0005ql-So
  Spool data file for 1Qmr1H-0005ql-So does not exist
  Continuing, to ensure all files removed
  Message 1Qmr1H-0005ql-So has been removed or did not exist

This is very annoying for that we could delete mails from "<>" (mailnull) through the mails by,
root@mailserver [~]# exim -bpru | grep '<>' | awk '{print $3}'|xargs exim -Mrm
We could add deleting mail by tim,
root@mailserver [~]# exim -bpru | grep '10h' | awk '{print $3}'|xargs exim -Mrm
Do add concerned parameter to delete mails from the Queue.

Example:
root@mailserver [~]# exim -bpru | grep 'user@domain' | awk '{print $3}'|xargs exim -Mrm

:-)

Friday, 7 February 2014

DNS: Command to delete a line containg specific from all *.db files in server


If you want to delete line containing the string "ns1.<domain_name>.com" from all *.db extention in the server.

Change directory by,
# cd  /var/named/
Run the command below,
# sed -i '/ns1.<domain_name>.com./d' *.db
Note: The above commamd will delete the line specified by the string "ns1.<domain_name>.com "  from all *.db files in the server .

[FIXED]mytop Error in option spec: “long|!”

Sometimes after installing "mytop" , it may show the following error,
Error in option spec: "long|!"

To fix this error , edit " /usr/local/bin/mytop " , by

# vim /usr/local/bin/mytop

Find the line  "long|!" and comment that line by adding '#' to that line.

Example :


#  "long|!"              =&gt; \$config{long_nums},

That's it, Now run mytop. :-)

Thursday, 6 February 2014

[FIXED]ERROR: Message not sent. Server replied: Connection timed out 110 Can’t open SMTP stream.


" Message not sent. Server replied: Connection timed out 110 Can’t open SMTP stream."

If you have got the above ERROR while trying to send mails from your account,


Login to the server as root and Edit the csf.conf,

# vi /etc/csf/csf.conf

 Search for the line " SMTP_BLOCK = "1" " and change it into " SMTP_BLOCK = "0" .

That's it. Now try to send mails.


Wednesday, 5 February 2014

script for checking Server memory

If you would like to know the advanced memory details of your server, Just do the below steps ..

1)Download the Script by executing the command,

# wget http://www.pixelbeat.org/scripts/ps_mem.py

2) Change the permission by ,

# chmod +x ps_mem.py
3) Show your server memory details by executing the command ,
# ./ps_mem.py

Now you could see the memory usage of all applications. :-)

[FIXED](98)Address already in use: make_sock: could not bind to address 80


If you'd got  the the following error  while starting Httpd service ,do the steps

 " (98)Address already in use: make_sock: could not bind to address 80"



First check and  make sure that the port 80/443 is not being used by any other service or application using the netstat command, by
# netstat -tulpn| grep :80
 If port 80 is bind to httpd, kill all process by ,
# killall -9 httpd
 Now start the httpd service by,
# /etc/init.d/httpd start

That's it. :-)





[FIXED]Name or service not known: mod_unique_id: unable to find IPv4 address of ""


When you came to know about Apache service status is not running and while trying to restart, it failed and the Apache error logs showed following error

"[alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "server.example.com"
Configuration Failed
"

Just check the Apache configuration syntax file by using command,

 # httpd -t
Syntax OK
This is Okay,

Now the issue will be on your " /etc/hosts ' file ,

# vi /etc/hosts
check the file and add your hostname.

after that, restart apache.

That's it. :-)

[FIXED]MySQL ERROR: The server quit without updating PID file

Some cases you will  may face to get this error on MySQL service.

root@ [~]# /etc/init.d/mysql status
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

If you've got  above error just remove the " MySQL lock file " and restart the server.
root@ [~]# rm /var/lock/subsys/mysql
rm: remove regular empty file `/var/lock/subsys/mysql’? y


 If you may get the following pid error while restarting the mysqld service,

 —————————
root@ [~]# /etc/init.d/mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL… ERROR! The server quit without updating PID file (/var/lib/mysql/hostname.pid).

 —————————

In this case check the MySQL process and kill it.

———————
root@ [~]# ps aux | grep mysql
root 32616 0.0 0.0 107412 864 pts/3 S+ 11:14 0:00 grep mysql
——————–

Here, there is no more MySQL process, so I need to check the MySQL log.

Sample log:
—————
130728 11:23:45 [ERROR] /usr/sbin/mysqld: unknown variable ‘set-variable=max_user_connections=50′
130728 11:23:45 [ERROR] Aborting

130728 11:23:45 InnoDB: Starting shutdown…
130728 11:23:45 InnoDB: Shutdown completed; log sequence number 2153996
130728 11:23:45 [Note] /usr/sbin/mysqld: Shutdown complete

130728 11:23:45 mysqld_safe mysqld from pid file /var/lib/mysql/hostname.pid ended
—————
If the issue still persist please check the MySQL log may be there is any incorrect entry on my.cnf file.

Edit the my.cnf file and #hash the enrty then start the MySQL.

—————
root@ [~]# /etc/init.d/mysql start
Starting MySQL.. SUCCESS!
root@ [~]#

—————

That's it. :-)