Status of lfd:lfd is stopped


Issue :

When I checked the status of lfd it’s shown as stopped.

root@ded17 [~]# /etc/init.d/lfd status
Status of lfd:lfd is stopped

I have tried to start it and that didn’t help.

Solution :

1. Open the csf configuration files.

# vi  /etc/csf/csf.conf

2. Then change “Testing=0” to “Testing=1”

3. Now restart the lfd service.

That’s all…!!!!!

The CPU has been Maxed Out for more than a 6 hour Period


Issue :

IMPORTANT: Do not ignore this email.
This is cPanel stats runner on server.xxxxxxxxxxx.com
While processing the log files for user pointl2, the cpu has been
maxed out for more than a 6 hour period. The current load/uptime line on the server at the time of
this email is
19:48:00 up 151 days, 01:21, 0 users, load average: 6.4, 7.43, 8.8
You should check the server to see why the load is so high and take
steps to lower the load.

Solution :

If you get the above mail from cPanel stating that the cpu has been maxed out for more than 6 hour period, It means that the stats processing on your server has stopped. The stats software that cPanel provides pauses the processing when the load becomes too high. If it stops for more than 6 hours, it will generate this mail to let the admin know that stats have not completed as they should have.

You can check the current load stats of your server using top command and you can find if any process is taking all the load.

You can fix the stat process by following the instructions below,

1. log in to WHM

2. Go to WHM >> Server Configuration >> Tweak Settings

3. Under the tab Stats and Logs you can find the option “Extra CPUs for server load” you need to change the value there from 0 to1.

Now it should be started.

That’s all…!!!!

Clear /tmp using tmpwatch


Tmpwatch tool is analyze and recursively delete files which have not been used certain period of time, especially clean up unwanted backup or /tmp directory or unused files.

When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does not follow symbolic links in the directories it’s cleaning (even if a symbolic link is given as its argument), will not switch filesystems, and only removes empty directories and regular files.

Installation of tmpwatch

——————-

You can install tmpwatch on your linux server with simple commands.

CentoOS/Fedora/RHCE :

yum install tmpwatch -y

Ubuntu:

sudo apt-get install tmpreaper

Once it’s installed, you can find the tmpwatch Installed Location uisng the following command.

 whereis tmpwatch

 

OPTIONS

-u, –atime

Make the decision about deleting a file based on the file’s atime (access time). This is the default.

-m, –mtime

Make the decision about deleting a file based on the file’s mtime (modification time) instead of the atime.

-c, –ctime

Make the decision about deleting a file based on the file’s ctime (inode change time) instead of the atime; for directories, make the decision based on the mtime.

-a, –all

Remove all file types, not just regular files and directories.

-d, –nodirs

Do not attempt to remove directories, even if they are empty.

-f, –force

Remove files even if root doesn’t have write access (akin to rm -f).

 

Commands using tmpwatch

———————-

1. To cleanup /tmp directory files that haven’t been accessed for at least 30 days.

tmpwatch 30d /tmp/

2. To delete all /tmp files and directories over 12 hours old

tmpwatch -am 12 /tmp

3.To delete all the files only  that haven’t been accessed for at least 30 hours.

 tmpwatch -am  30 –nodirs /tmp

We can also set cron jobs to run the same automatically by server. You can add the cron job like pasted below sing your cPanel or as root user.

 0 4 * * * /usr/sbin/tmpwatch -am 12 /tmp

That’s all….!!!

NginxCP: Install Nginx as reverse proxy on cPanel server


We know that both Apache and Nginx are powerful and effective web-servers. Apache is the topmost webserver since it was released in 2006 and Nginx is now using top websites. The reason for using Apache and Nginx are clear, Apache’s power and Nginx’s speed.

By setting Nginx as reverse proxi, we can increase the websites speed and performance in the server. This is because, Nginx will take care of att static contents in the website such as CSS, images, SWF files, MP4 and more and Apache will manage the rest of requests (dynamic requests – php page). This is known as Nginx reverse proxy setup. Nginx stand as front end servers with a powerful backend Apache server.

nginxCP is a cpanel plugin that is used to manage nginx service in cpanel server. As we know that nginx can handle static contents better than apache, we will configure nginx to run on port 80 and will forward dynamic requests to apache on port 8081.

Installation

—————

To configure nginx as revcrse proxy, we need to install an apache module mod_rpaf.

Mod_rpaf installation:

First of all we need to login as root to do the full installation process. After login, you can proceed with following commands.

 

# cd /usr/local/src

                  # wget https://nginxda.googlecode.com/files/mod_rpaf-0.6.tar.gz

                 # tar xvzf mod_rpaf-0.6.tar.gz

                 # cd mod_rpaf-0.6

                 # /usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

For Apache 2.4 : You need to apply a patch for mod rpaf. For that run the following commands.

    

                 # git clone git://gist.github.com/2716030.git

                 #patch mod_rpaf-2.0.c 2716030/mod_rpaf-2.0.c.patch

Now we are going to install nginxCP plugin. Since we need to run both Apache and nginx on the same server, we have to assign both of them in different ports. You can change apache port to 8081 from your whm tweak settings and nginx will listen to 80 as default.

For changing the Apache port, please login to WHM and go to Tweak settings.

—————————————

WHM > Server Configuration > Tweak Settings > Apache non-SSL IP/port. 

—————————————

change he port to 8081 on “Apache non-SSL IP/port” option.

Now we can proceed with nginxCP installation using the following commands.

# cd /usr/local/src

                # wget http://nginxcp.com/latest/nginxadmin.tar

                # tar xf nginxadmin.tar

                # cd publicnginx

                # ./nginxinstaller install

                # /usr/local/cpanel/whostmgr/bin/whostmgr ./setrhash

To server static files using nginx, you have to  convert apache virtualhost to nignx virtualhost. You can download the script at http://blog.supportmonk.com/nginx.txt ,  rename it as nginx.sh , provide 755 permission and execute it. You have to create an empty file /usr/local/nginx/conf/vhost.conf

  # touch /usr/local/nginx/conf/vhost.conf

              # wget  http://blog.supportmonk.com/nginx.txt

              #  cp nginx.txt nginx.sh

              # chmod 755 nginx.sh

              # ./nginx.sh

Configuration is complete. You can test nginx configuration and can start it.

 

# /usr/local/sbin/nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

# /etc/init.d/nginx start

While testing, there is a chance to get the following error.

——————————-

nginx: [emerg] unknown “no_cache” variable
nginx: configuration file /etc/nginx/nginx.conf test failed

——————————-

This error would be occured when you don’t have any accounts. Try to create an account using WHM and run the test command again.

That’s all..!!

Extending Swap space on an LVM


Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 1 GB to 2 GB, but there is only 2 GB of swap space. It might be advantageous to increase the amount of swap space to 4 GB if you perform memory-intense operations or run applications that require a large amount of memory.

You have three options: create a new swap partition, create a new swap file, or extend swap on an existing LVM2 logical volume. It is recommended that you extend an existing logical volume.

To do so, perform the following procedure (assuming /dev/VolGroup00/LogVol01 is the volume you want to extend by 2 GB):

1.Disable swapping for the associated logical volume:

# swapoff -v /dev/VolGroup00/LogVol01

2.Resize the LVM2 logical volume by 2 GB:

# lvresize /dev/VolGroup00/LogVol01 -L +2G

3.Format the new swap space:

# mkswap /dev/VolGroup00/LogVol01

4.Enable the extended logical volume:

# swapon -v /dev/VolGroup00/LogVol01

To test if the logical volume was successfully extended, use “cat /proc/swaps” or “free -m” to inspect the swap space.

Apache restarting every 2 hours


Issue: In my server, I could see that the apache is restarting gracefully every 2 hour.

#grep Graceful /usr/local/apache/logs/error_log
[Mon Jan 05 18:16:08 2014] [notice] Graceful restart requested, doing restart
[Mon Jan 05 20:12:53 2014] [notice] Graceful restart requested, doing restart
[Mon Jan 05 22:09:39 2014] [notice] Graceful restart requested, doing restart
[Tue Jan 06 00:06:24 2014] [notice] Graceful restart requested, doing restart

Solution:

Make a backup of the Apache configuration file

# cp -rp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf_back

*Login to WHM
*Click Service Configuration
*Click Apache Configuration
*Click Piped Log Configuration
*Check the box labeled Enable piped Apache logs
*Click the Save button

Piped logging is extremely powerful when used correctly, and has far more flexibility than what we are using here. The way it is described here, we will be attempting to negate the memory hungry apache processes that creep up when a server is hosting very low traffic websites (less than 1 request per second) with traditional Apache log configurations.

That’s all…….!!!

Changing eaccelerator cache directory


Issue :

We know that the default directory for eaccelerator cache is “/tmp/eaccelerator”. In most of the cases, this directory causing the /tmp to fill and that will cause many issues. In such cases it’s better to change the cache directory to another large partition.

Solution:

Use the following command to find cache director specified in “php.ini”‘ file.

# grep eaccelerator.cache_dir /usr/local/lib/php.ini

i.e;

root@tricks[~]# grep eaccelerator.cache_dir /usr/local/lib/php.ini
eaccelerator.cache_dir=”/tmp/eaccelerator”
root@tricks[~]#

Then change it to another directory “/var/eaccelerator” and save the file.

i.e; eaccelerator.cache_dir=”/var/eaccelerator”

Then create the folder “/var/eaccelerator”

# mkdir /var/eaccelerator

After that use the following commands.

#service httpd stop

#rm -rf /tmp/eaccelerator

#service httpd start

That’s all….!!!!

Eaccelerator filling up /tmp folder


Issue:

I have found that /tmp is full and the issue was due to eaccelerator cache. You can check whether the eaccelerator is filling your tmp folder using “du -sch” command.

solution:

Fist check the size of eaccelerator using the following command.

root@tricks[~]# du -sch /tmp/eaccelerator

261M /tmp/eaccelerator
261M total
root@tricks [~]#

You can clear it using the following command.

tmpwatch –mtime –all 336 /tmp/eaccelerator

Now check the size of eaccelerator using “du -sch” command.

root@tricks[~]# du -sch /tmp/eaccelerator
40K /tmp/eaccelerator
40K total
root@tricks [~]#

That’s all……..!!!

sh: /usr/local/bin/sendmail-logger: No such file or directory


Issue: I got the above error while trying to send mail from a test php file after enabling mail() function on the server.

sh: /usr/local/bin/sendmail-logger: No such file or directory

Solution:

1.copy /usr/local/lib/php.ini to the user’s document root and change the ownership.

# cp  /usr/local/lib/php.ini /home/username/public_html

#chown username.username /home/username/public_html/php.ini

2.Then edit /home/username/public_html/php.ini

# vi /home/username/public_html/php.ini

Now change the php.ini as described below.

sendmail_path = “/usr/sbin/sendmail -t -i” –> enable this
;sendmail_path = /usr/local/bin/sendmail-logger—> comment this

That’s all………!!!

 

MySQL: Can’t create/write to file ‘/backup/tmp/#sql_3c6_0.MYI’ (Errcode: 2)


Issue: I got this error when accessing the certain pages of drupal website.

MySQL: Can’t create/write to file ‘/backup/tmp/#sql_3c6_0.MYI’ (Errcode: 2)

Solution:

Check the location of tmp directory inside my.cnf and change it to /tmp

1.check mysql config : my.cnf

cat /etc/my.cnf | grep tmpdir

2.If the tmpdir is missing or /tmp is not mentioned there, please add it.

i.e; tmpdir=/tmp to my.cnf under [mysqld]

3.Restart the mysql server

/etc/init.d/mysql restart

That’s all……..!!!!

Previous Older Entries

Blog Stats

  • 37,403 hits