Should you kill or terminate a misbehaving process.

Have you ever had a linux process that was not running but when you try to start or restart the process nothing happens. You may find that you need to kill the process before you try to restart it because the process is actually still alive and not responding or not actually alive but the pid (which is a unique identifying number that tells the kernel that the process has stated or is alive) was not removed when the process ended. So the kernel thinks that the process is working just fine when in fact it is not and won’t start it a new.

Before you kill the process you should always try to terminate it first. Because terminate tries to end the process gracefully and finish writing any remaining data that the process may have stored in memory as well terminate will finish writing any logging data to assist you to find out what caused the process to fail in the first place

The command to terminate a process is

Code
kill -15 pid

replace pid with the pid number

If your attempt to terminate the process fails then you will have to use the more powerful kill command which will bypass the process and ask the kernel to kill the misbehaving process directly.

The command to have the kernel kill a process is

Code
kill -9 pid

replace pid with the pid number

Before you can kill the process you will have to find its pid. To find out the pid of a running process in virtualmin you can go to

Webmin> System> Running Processes>

and select pid from the Display menu then scroll to find the pid of the process you are looking for. Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,Click on the pid of the process you want to kill and you will be taken to a new screen where you can terminate or kill the process by clicking the matching button.

Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,If you are not a virtualmin user you can open a terminal window and type

Code
ps aux | less

which will give you a list that looks something like

Linux, kill, terminate, kill -15 pid, kill -15, kill -9 pid, kill -9, pid, linux process, process, not running, process not running, start, restart, start or restart, not responding, process not responding, kernel, pid not removed, kill the process, stop the process, terminate the process, end the process, end the process gracefully, writing any logging data, virtualmin, webmin, Running Processes,when you have the pid you need to kill the process. As mentioned above you should always try the terminate command first. In the terminal window type

Code
kill -15 pid

replace pid with the pid number

If the process does not terminate you will the need to use the more powerful kill command

Code
kill -9 pid

replace pid with the pid number

Fail2ban for the uninitiated.

What is fail2ban and why you should install it.

fail2ban_logoIn this day and age every web site owner or administrator is obsessed with improving the amount of traffic that flows to their site, even though little thought is given to weather or not, that traffic is of any use to their site or what harm it is potentially doing. Read why you need to consider who is coming to your site and what you can do to protect yourself from spammers and scammers.

How to Fix “mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072)” error on Ubuntu 12.04 LTS (Precise Pangolin) Linux.

If you are trying to upload a file through WordPress or another content system to your web site and your website is running on Apache2/PHP5/mod_fcgid, and your browser displays the error:

Browser error
Internal server error

and in your Apaches error log you see something like

Apaches error log
[Wed Nov 07 13:12:45 2012] [warn] [client 192.168.XXX.XXX] mod_fcgid: HTTP request length 131619 (so far) exceeds MaxRequestLen (131072), referer: …

This error is because the default value of FcgidMaxRequestLen is 131072 which is very small see Apache Module mod_fcgid for more information.

First check in your php.ini that upload_max_filesize has a big enough value for your upload. The default in php.ini is upload_max_filesize = 2M which stands for 2 megabytes (MB). If it is not set, set it to

Set php.ini
upload_max_filesize = 2M

Next edit your file /etc/apache2/mods-available/fcgid.conf, or if you have Virtualmin installed go to Webmin> Servers> Apache Webserver> and select the Global configuration tab then click Edit Config Files. Now select /etc/apache2/mods-available/fcgid.conf in the dropdown list then click the Edit Directives in File button. Either way you should see something like this.

Current directives
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20
</IfModule>

You now want to add the FcgidMaxRequestLen 2097152 directive to make the file look like this. NOTE: FcgidMaxRequestLen 2097152 = 2MB.

Edit directive
<IfModule mod_fcgid.c>
AddHandler    fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidMaxRequestLen 2097152
</IfModule>

Now save the changes and restart Apache with

Restart Apache
/etc/init.d/apache2 restart

Or if working in Virtualmin there is a Stop Apache link in the top right hand corner of your screen click it and when Apache has stoped the link will change to a Start Apache link. Click it also. And that is it you will now be able to upload your 2MB files.