Cpanel

Info: Configure Redmine on cpanel hosting account with sending and receiving emails.

Posted on Updated on

Wiki : http://en.wikipedia.org/wiki/Redmine

Redmine is a free and open source, web-based project management and bug-tracking tool. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. It handles multiple projects. Redmine provides integrated project management features, issue tracking, and support for various version control systems.
The design of Redmine is significantly influenced by Trac, a software package with some similar features.
Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database. It is part of the Bitnami app library that provides an installer and virtual machine for ease of deployment.

Before starting installation you have to make sure that Ruby on rails is working fine in your environment, If not you can follow the installation document for more help.

Installaing Ruby on Rails with Cpanel : https://enlook.wordpress.com/2013/11/19/howto-install-ruby-on-rails-with-cpanel/

Once you have done, then start the redmine installation steps.

Login to the terminal using primary account logins.

#ssh myaccount@mydomain.com

  1. Create rails_app folder and redmine folder within it then go inside that folder
    # mkdir -p ~/rails_apps/redmine/
    # cd ~/rails_apps/redmine/
  2.  Download redmine redmine-2.3.3 or latest stable version, extract it and move the content out of it, then delete the files not being used.
    1. # wget http://files.rubyforge.vm.bytemark.co.uk/redmine/redmine-2.3.3.tar.gz
      # tar -zxvf redmine-2.3.3.tar.gz
      # mv redmine-2.3.3/* ./
      # rm -rf redmine-2.3.3/
  3. Move example files where they can be used
    # cd config
    # mv database.yml.example database.yml
    # mv configuration.yml.example configuration.yml
  4. Creating the MySQL Database/User/Password
    Login to Cpanel account, Create a database , user and grant full privilege to the new user for the particular database.
    cPanelXdatabase
  5. Modifying your database.yml file.
    # vi database.yml
    production:
    adapter: mysql
    database: redmine
    host: localhost
    username: myaccount_databaseuser
    password: newpassowd
    encoding: utf8
  6. Updating the ~/rails_apps/redmine/public/.htaccess file
    # cd ../public/
    # pwd
    1. You should see something similar to this.

    /home/myaccountuser/rails_apps/redmine/public

        Add these lines
    Options -MultiViews
    PassengerResolveSymlinksInDocumentRoot on
    #Set this to whatever environment you'll be running in
    RailsEnv production
    RackBaseURI /
    SetEnv GEM_HOME /home/myaccountuser/rails_apps/redmine/public
    
    # set to resolve avoid rails control to the folder for image resolution   
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/images.*
    RewriteRule .* - [L]
  7. Create a subdomain eg: projects.mydomain.com
    Follow cpanel procedure to create subdomain. Subdomains
  8. Remove projects folder inside public_html and create symbolic link.
    # rm -rf ~/public_html/projects
        Creating the symlink
    # ln -s ~/rails_app/redmine/public ~/public_html/projects
  9. Updating Environment variables in ~/.bashrc file
        Add these lines to the bottom of your ~/.bashrc file
               export HPATH=$HOME
               export GEM_HOME=$HPATH/ruby/gems
               export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3
               export GEM_CACHE=$GEM_HOME/cache
               export PATH=$PATH:$HPATH/ruby/gems/bin
               export PATH=$PATH:$HPATH/ruby/gems
        after which source your .bashrc file
            # source ~/.bashrc
        You will then need to check your rails version
            rails -v && rake --version && gem -v
          You should get this message

    ruby

    Rails 4.0.1
    rake, version 0.9.2.2
    1.8.23
  10. Running bundle install
    # cd ~/rails_apps/redmine/
    # bundle install
    # rake generate_session_store
  11. Running generate_session_store or generate_secret_token
    1. # rake generate_session_store
        If you get an error saying that command is deprecated, run this command instead;
     # rake generate_secret_token
  12. Start the site session
    # rake db:migrate RAILS_ENV=production
  13. Configuring outgoing emailsUpdate the setting in configuration.yml
    default:
     email_delivery:
     delivery_method: :smtp
     smtp_settings:
     address: localhost
     port: 25
     domain: mydomain.com
     authentication: :none
    enable_starttls_auto: false

    Now the redmine have capable to send emails using exim install in the cpanel server.

  14. Configuring Incomming emails for IMAPCreate a cron job for the script to get continuous email feaching
    cPanelX

    For the first this script must execute from the terminal, so it will display error if any.

    /usr/bin/rake -f /home1/innovat4/rails_apps/redmine/Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" port=143 host=mydomain.com username=projects@mydomain.com password=myemailpassword

    For more help follow the official link http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails#Enabling-unknown-users-to-create-issues-by-email

Note : Each configuration required rails environment reboot for that you can follow the simple way.

# touch ~/rails_app/redmine/tmp/reboot.txt

Howto: Install Ruby on Rails with Cpanel

Posted on

Installing Ruby on Rails on cPanel

Start the installation steps with root privileged or sudo user or you have to submit a tickte to your hosting provider for enabling Ruby on rails in you hosting account.

For detailed information about RubyGems: commands and system, read their User Guide Manuals at: www.rubygems.org/

– To install Ruby on Rails:

SSH to the server and run this command:

  • /scripts/installruby

If LIBSAFE is installed on your server, you need to add the directive /usr/bin/ruby to the exception list to prevent buffer overflow errors. SSH to the server and run this command:

  • echo “/usr/bin/ruby” >> /etc/libsafe.exclude

The local path to the binary package is:
/usr/bin/gem

To check on the current version installed on your server:

  • /usr/bin/gem -v

To list all installed gems:

  • /usr/bin/gem -l

– To uninstall Ruby on Rails:

  1. List all the gems installed on your server and remove them all using the following command:
    • /usr/bin/gem uninstall NAME_OF_GEM

    The cPanel/WHM, by default, installs the following Gems:
    rails, mongrel, fastthread, actionmailer, actionpack, activerecord, activeresource, activesupport, cgi_multipart_eof_fix, daemons, gem_plugin, rake. For example, to uninstall the Gem: rails, we’ll run this command:

    • /usr/bin/gem uninstall rails

    Sample output:
    Successfully uninstalled rails version 0.1.6

  2. Remove Gem directories and the binary package using the following commands (in that order):
    • /bin/rm -rf /usr/lib/ruby
    • /bin/rm -rf /home/cprubygemsbuild
    • /bin/rm -fv /root/.gem
    • /bin/rm -fv /usr/bin/gem
  3. Remove all ruby directories added to a client’s root directory. The local path is: /home/USER/ruby/
  4. Restart the cPanel (un-necessary but do it any way)
  • /sbin/service cpanel restart

 

Error: SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root?

Posted on Updated on

After recovering my Cpanel server it was getting the Internal server error for every domain hosted and throwing  some messages in error log

[Wed Jul 17 09:46:14 2013] [error] [client 111.222.333.444] Premature end of script headers: index.php, referer: http://domain.com/
[Wed Jul 17 09:46:14 2013] [error] [client 111.222.333.444] SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root?

My server is configured for running suphp in CGI mode with Mod-security, So it will check the sticky bit of the suphp binary.The error was because the suphp binary was missing its suid permissions and assigning it fixed the issue.

chmod +s /opt/suphp/sbin/suphp

This should fix the issue instantly.

 

 

Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file

Posted on

 Apache  service on a Server stops while restart it shows following messages in error_logs
[Thu Jun 20 20:04:20 2013] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
Configuration Failed

Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.

Using the below command you can semaphores list.

root@server04 [~]# ipcs -s | grep nobody

So, In-order to clear the semaphores list. We have execute the following command.

root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.

Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.

# Increases the semaphore limits & extend Apache’s uptime.

kernel.msgmni = 512
kernel.sem = 250 128000 32 512

Then load the new settings into the kernel using the command.

root@server04 [~]# sysctl -p
Now you are in safe zone.

Howto: Renewing Exim SSL certificate

Posted on Updated on

Exim

Renewing exim SSL certificate without using Cpanel or exim scripts,first we have to create the certificate and replace the file with suitable permissions,  follow the below steps to do.

1, Creating Self signed certificate files using Openssl.

root@server09 [~]# openssl req -x509 -newkey rsa:1024 -keyout /root/server.key -out /root/server.crt -days 365 -nodes
Generating a 1024 bit RSA private key
......................++++++
.............................................++++++
writing new private key to '/root/server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:IN
State or Province Name (full name) [Berkshire]:Karnataka
Locality Name (eg, city) [Newbury]:Banglore
Organization Name (eg, company) [My Company Ltd]:Private Ltd
Organizational Unit Name (eg, section) []:JWH
Common Name (eg, your name or your server's hostname) []:server.domain.com
Email Address []:

2, Verify the existing location and filename and replace the files

root@server09 [~]# ll /etc/exim.key /etc/exim.crt
lrwxrwxrwx 1 root root 31 2月 26 2010 /etc/exim.crt -> /var/cpanel/ssl/exim/myexim.crt
lrwxrwxrwx 1 root root 31 2月 26 2010 /etc/exim.key -> /var/cpanel/ssl/exim/myexim.key
mv /var/cpanel/ssl/exim/myexim.crt /var/cpanel/ssl/exim/myexim.crt_30_5_2013
mv /var/cpanel/ssl/exim/myexim.key /var/cpanel/ssl/exim/myexim.key_30_5_2013
mv /root/server.key /var/cpanel/ssl/exim/myexim.key
mv /root/server.crt /var/cpanel/ssl/exim/myexim.crt
chmod 660 /etc/exim.key /etc/exim.crt /var/cpanel/ssl/exim/myexim.key /var/cpanel/ssl/exim/myexim.crt
chown mailnull.mail /etc/exim.key /etc/exim.crt /var/cpanel/ssl/exim/myexim.key /var/cpanel/ssl/exim/myexim.crt

3, Restart exim

root@server09 [~]# service exim restart

ERROR: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified

Posted on Updated on

One of our server getting odbc_connection error after migration, this will usually  happens because ODBC module has not enabled on the server,  While I tried to set up ODBC with freeTDS in order to connect to a MSSQL server faced several issues.

MSSQL uses Tabular Data Stream (TDS) as a communication protocol which is same like in Sybase. freeTDS is an implementation of TDS protocol.

Before trying to connect with freetds to the mssql server, make sure, that your MSSQL server has remote access to connect.

[02-May-2013 02:21:31 America/Denver] PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/anand/public_html/mssql2000.php on line 69

We need below packages installed to get this done.

1, php-odbc
2, unixODBC
3, freetds

Installation : 

#pecl  install php-odbc
#yum install unixODBC-devel unixODBC freetds-devel freetds

Or,

Download unixODBC and untar it

#wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz
#tar –xzf unixODBC-2.3.0.tar.gz
#cd unixODBC-2.3.0 ; ./configure ; make ; make install

Installing freeTDS
Set environmental variable at /etc/profile. Add following lines at end

#vi /etc/profile
 # TDS
SYBASE=/usr/local 
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib 
export SYBASE LD_LIBRARY_PATH 
#http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
#tar –xzf freetds*.tar.gz ; cd freetds* ; ./configure --with-tdsver=8.0 --with-unixodbc=/usr/local ; make ; make install

Configuration:
Note: tdsver=8.0 if you use SQL 2000, tdsver=7.0 if you use SQL 7.0, More info about freetds.conf here

root@server [~]# cat /etc/freetds.conf
[MSSQLSERVER]               
host = 11.222.333.44
port = 1433
tds version = 8.0

Setup ODBC:
Create template for both driver and configuration. before creating make sure that the driver files are valid.

root@server [~]# vi tds.driver.template
#Driver for MS SQL
[FreeTDS]                       #"FreeTDS" is the unique name for this driver
Description = FreeTDS driver
Driver = /usr/lib64/libtdsodbc.so.0
Setup = /usr/lib64/libtdsS.so.1
FileUsage = 1
UsageCount =1

root@server [~]# vi tds.datasource.template
[MSSQL]               #"MSSQL" is the DSN name that we call to connect database
Driver = FreeTDS      # name that we specified in the driver file
Description = MSSQL ReflectiveLearning
Trace = No
TraceFile = /var/log/freetds.log
Servername = MSSQLSERVER    # this  name specified in the freetds.conf
Port = 1433
Database = reflective_Live
TDS_Version = 8.0
 Now install the data source and driver

The below commands will create configuration file for odbc but odbc.ini has create in users home dir by default we have to move it manually to /etc/

odbcinst -i -d -f tds.driver.template
odbcinst -i -s -f tds.datasource.template
cp -rpf ~/.odbc.ini /etc/odbc.ini
mv /etc/odbc.ini /usr/local/etc
mv /etc/odbcinst.ini /usr/local/etc
cd /etc
ln -s /usr/local/etc/odbc.ini
ln -s /usr/local/etc/odbcinst.ini
chmod 0664 /usr/local/etc/odbc*.ini
cd ~

check by using command line
#tsql -H Hostname_OR_IP -p PortNumber -U Username

root@server [~]# isql -v DSNname Username 'Password'
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> quit
That’s all, now the application will works fine.
some PHP code to connect to it
<?php
//*************************************************************************
//Open Database Connection
//************************************************************************* 
$dbserver="ipaddress";
$dbusername="tester4";
$dbpassword="password1234";
$defaultdb="testdb";
$cn = mssql_connect($dbserver,$dbusername,$dbpassword) or die("Connection Error");
$db = mssql_select_db($defaultdb,$cn) or die("Database Error");
echo "Connection Success"
?>

Some of the useful commands,

odbcinst -j         # to check the ODBC version and configuration.
odbcinst -q -d   # View loaded drivers.
odbcinst -q -s   # View DSN entry
tsql -LH 22.33.55.44   #To list MSSQL server instant name,version etc.,
osql -S DSN -U Username -P ‘Password’ #list the configuration files loaded to connect ODBC

Install / Enable PHP MsSQL Extension in cPanel/WHM Server

Posted on

For enabling mssql support in PHP on cpanel/WHM installed server we can’t use easyapache in this case,  we need FreeTDS installed and configured which is a set of Unix/Linux libraries that implement the TDS protocol. First we will need to download and install FreeTDS, you can find more information and download link at http://www.freetds.org URL. Note the exact installation steps below :

Packages :
1. unixODBC
2. freeTDS
3. mssql.so
step :1  unixODBC

yum install  unixODBC unixODBC-devel

Step :2  freeTDS

cd /usr/local/src
wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
tar zfvx freetds-stable.tgzcd freetds-*;
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld; make ; make install 
echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5
touch /usr/local/freetds/lib/libtds.a
touch /usr/local/freetds/include/tds.h

Use this line if you get any error like no such file or directory

ln -s /usr/include/sqlext.h /usr/local/include/sqlext.h

If it it is a 64 bit server then make the following softlink

ln -s /usr/local/freetds/lib/  /usr/local/freetds/lib64

Step :3  mssql.so

Now run Easy Apache and make sure that Mysql, Mysql of the system, amd Mysqli are all selected.

/scripts/easyapache

 Now you can check Mysql enabled

root@server [~]# php --info |grep  "mssql"
MSSQL Support => enabled

Error: Native SSL support failed to pass the startup test.

Posted on

If you are getting  above error then  it mean CPanel has been  updated to  the lasted version  and it also updates  the “Net::SSLeay”  version to  1.36 and that is why  you get  the error :

Native SSL support failed to pass the startup test.  stunnel was started instead.
The exact error was: [linktest=BinCheck ok
] [binary=/usr/local/cpanel/cpsrvd-ssl] [cpsrvd=Net::SSLeay object version 1.36 does not match $Net::SSLeay::VERSION 1.32.
]

In order to fix this follow the below steps :
1) Download the Net_SSLeay 1.30 or 1.32

root@server[#] cd /usr/local/src
root@server[#] wget http://mirror.yourconnect.com/CPAN/authors/id/F/FL/FLORA/Net_SSLeay.pm-1.30.tar.gz


or


root@server[#] wget http://mirror.yourconnect.com/CPAN/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz

2) Then extract the tar.gz file

root@server[#] tar -zxf Net_SSLeay.pm-1.30.tar.gz

or

root@server[#] tar -zxf Net-SSLeay-1.32.tar.gz

Then go to dir Net_SSLeay.pm-1.30 or Net-SSLeay-1.32

root@server[#] cd Net_SSLeay.pm-1.30/

or

root@server[#] cd Net-SSLeay-1.32/

and then execute Make file and then perform make install

root@server[/usr/local/src]# ./Makefile.PL -t
root@server[/usr/local/src]# make install

Now, finally you can check the installed module from WHM >> Main >> Software >> Install a Perl Module

That’s all you are done.

Error: SSH clossing connection after successful authentication

Posted on

I have experiencing the issue with SSH, that cause closing connection after the successful authentication. But I didn’t see any thing in the log moreover it is a Cpanel server

I suspected this would be the problem with profile setting, after goggling for hours I got the solution, in  cpanel server their was an autofix script,

Download script from here :-
http://httpupdate.cpanel.net/autofixer/safesshrestart
Or
You may execute the script direct via WHM
http://x.x.x.x:2086/scripts2/autofixer (Replace x.x.x.x with the server IP address)

Verbose output will be like this :

anand@test-desktop:~$ ssh -v root@11.222.333.444
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 11.222.333.444 [11.222.333.444] port 22.
debug1: Connection established.
debug1: identity file /home/anand/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/anand/.ssh/id_rsa-cert type -1
debug1: identity file /home/anand/.ssh/id_dsa type -1
debug1: identity file /home/anand/.ssh/id_dsa-cert type -1
debug1: identity file /home/anand/.ssh/id_ecdsa type -1
debug1: identity file /home/anand/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 29:b6:2b:c9:4e:82:9d:22:6c:2b:c4:0d:61:10:b4:a5
debug1: Host '202.228.207.91' is known and matches the RSA host key.
debug1: Found key in /home/anand/.ssh/known_hosts:115
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/anand/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/anand/.ssh/id_dsa
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
Authenticated to 11.222.333.444 ([11.222.333.444]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US
Last login: Thu Apr 11 06:21:46 2013 from 222.200.211.111
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 11.222.333.444 closed.
Transferred: sent 3424, received 2296 bytes, in 469.7 seconds
Bytes per second: sent 7.3, received 4.9
debug1: Exit status 0

I ran the below steps to fix this issue :

[root@svl3 ~]# wget http://httpupdate.cpanel.net/autofixer/safesshrestart
--2013-04-11 06:18:15-- http://httpupdate.cpanel.net/autofixer/safesshrestart
Resolving httpupdate.cpanel.net... 69.72.212.11, 70.87.220.252, 72.233.42.250, ...
Connecting to httpupdate.cpanel.net|69.72.212.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2985 (2.9K) [application/octet-stream]
Saving to: “safesshrestart”
100%[====================================================================================================>] 2,985 13.7K/s in 0.2s
2013-04-11 06:18:15 (13.7 KB/s) - “safesshrestart” saved [2985/2985]
[root@svl3 ~]# chmod +x safesshrestart
[root@svl3 ~]# ./safesshrestart 
Attempting to locate sshd binaries installed on the system ...<br />
Located /usr/sbin/sshd<br />
Done.<br />
Killing exisiting sshd processes...<br />
Stopping sshd: [ OK ]
<br />
Done.<br />
configuring sshd to run on port 22<br />
/usr/sbin/sshd successfully started!<br />
root 3068 0.0 0.0 64164 1060 ? Rs 06:19 0:00 /usr/sbin/sshd -f /var/cpanel/safe_sshd
<br />

Error: unable to start mysql 130207 5:33:16 /usr/sbin/mysqld: Can’t open file: ‘sends.MYI’. (errno: 145)

Posted on Updated on

MySQL crashes frequently,  Getting error while starting the service “No mysqld pid file found. Looked for /var/lib/mysql/server.910mall.jp.pid.” .  It is because of  table crash. repair crashed tables using below commands.

Engine : MyISM

# repair the tables
root@server [/var/lib/mysql]# myisamchk -r */*.MYI
- recovering (with sort) MyISAM-table 'DB_wrdp1/wp_post2cat.MYI'
Data records: 1
- Fixing index 1
- Fixing index 2

---------
- recovering (with keycache) MyISAM-table 'DB_wrdp1/wp_postmeta.MYI'
Data records: 0

---------
- recovering (with sort) MyISAM-table 'DB_wrdp1/wp_posts.MYI'
Data records: 2
- Fixing index 1
- Fixing index 2

---------- recovering (with sort) MyISAM-table 'DB_wrdp1/wp_usermeta.MYI'

Data records: 2
- Fixing index 1
- Fixing index 2
- Fixing index 3

---------

# Start Mysql
root@server [/var/lib/mysql]# /etc/init.d/mysql start