How to find zombie processes on linux

CentOS, Linux, Tips and Tricks, Ubuntu
My NAGIOS monitor alerted me that of my dedicated server has 10 Zombie processes, how to find Zombie processes via command line on Linux especially CentOS? [code] ps aux | awk '{ print $8 " " $2 }' | grep -w Z [/code] So it returns state (Z = Zombie) and the process id (PID) [code]root@sirius [~]# ps aux | awk '{ print $8 " " $2 }' | grep -w Z Z 4399 Z 4435 Z 4868 Z 5143 Z 5400 Z 5834 Z 7584 Z 11943 Z 16286 Z 24365[/code] Technically, you cannot kill a zombie process since its already dead but the entry in the process table is not removed because the parent will access the result via the PID in the process table.
Read More

Routing a root domain / zone apex / naked domain to Amazon S3

Reviews, Tips and Tricks
Even though the sound of hosting a static website entirely out of Amazon s3, it has a catch. You can only host subdomains there (including www.example.com, cdn.example.com, images.example.com etc assuming your primary domain name is example.com) but not "apex domain" like example.com I had an idea of redirecting the example.com traffic to one of my VPSes and then redirecting via .htaccess or PHP to www.example.com at which point www is already hosted on s3 Just to double check, I posted the question online and got a reply from D. Svanlund who pointed me out to an awesome time-saver service still in beta called ARecord.net. They are right when they say Zone Apex issue on Cloud.
Read More

How to find specific files and send alerts

CentOS, How to, Linux, Tips and Tricks, Ubuntu
Maintaining a shared hosting server is a full time job but tools and proper checks and balances can help make this burden lot less. I manage a shared hosting server for one of my friends and numerous times the scripts that people have installed over on their websites have vulnerabilities and hackers exploit it to upload stuff that mass-email or do other nasty stuff. Luckily, most of these exploits have common patterns like files names or other signatures that make them traceable (most of the time the so called hackers are just kiddy scripts) Create a file and put this in it [code]#!/bin/bash find /home -name 'paypal.com*' | mail -s '[Woodcrest] Phishing Alert!' me@mydomain.com find /home -name 'rout.php' | mail -s '[Woodcrest] Phishing Alert - Mail Bomber!' me@mydomain.com[/code] This is…
Read More

package-cleanup: command not found

CentOS, How to, Linux, Tips and Tricks
I tried to do package-cleanup and found this [code highlight="2"]root@ns1 [~]# package-cleanup --problems -bash: package-cleanup: command not found[/code] If I was on Ubuntu, I would have done "apt-get install package-cleanup" but it does not work that way on CentOS, its actually available in yum-utils package, install it by typing [code]yum install yum-utils[/code] Enjoy!!
Read More

How to disable SELinux

CentOS, How to, Linux, Tips and Tricks
SELINUX is a security feature on CentOS but some software such as SolusVM will require that SELINUX be disabled [code] Installation log : /tmp/install.log Add this slave to your SolusVM master using the following details: ID Key .......... : ABC ID Password ..... : XYZ IMPORTANT!! You need to setup a network bridge before you can use KVM on this server. Please see the following link: http://wiki.solusvm.com/index.php/KVM_Network_Bridge_Setup Please set SELINUX=disabled in /etc/selinux/config before rebooting. Thankyou for choosing SolusVM. [/code] The solution? 1) Edit /etc/selinux/config using your favourite editor [code][root@kvm ~]# nano /etc/selinux/config[/code] and set SELINUX=disabled [code highlight="6"]# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings…
Read More

CentOS minimal template’s issue with crontab

How to, Tips and Tricks
On my CentOS 5.x 64bit XEN PV template (XEN PV is a virtualization type, this means I am talking about a VPS) doing 'crontab -e' gave me the following error [code] [root@vpsadmin ~]# crontab -e no crontab for root - using an empty one /bin/sh: /bin/vi: No such file or directory crontab: "/bin/vi" exited with status 127 [/code] To correct this issue, do the following [code] [root@vpsadmin ~]# touch ~/.bashrc [root@vpsadmin ~]# export VISUAL=nano [root@vpsadmin ~]# source ~/.bashrc [/code] So, now if you do 'crontab -e' it will work as it should [code] [root@vpsadmin ~]# crontab -e no crontab for root - using an empty one crontab: no changes made to crontab [/code]
Read More

Install htop

CentOS, How to, Linux, Reviews, Tips and Tricks, Ubuntu
[caption id="attachment_1147" align="aligncenter" width="300" caption="htop - an alternative to linux top"][/caption] htop is a sleek utility that allows you to interactively view processes running in a linux box. I can safely say its a good alternate to 'top' To install htop just run this after installing epel repo [code]yum install htop[/code]
Read More

Ubuntu – Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/sqlite.so’

Linux, Tips and Tricks, Tutorials, Ubuntu
The other day, I was getting this weird error [code]PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0[/code] Fix it by doing this [code]root@beta:~# rm -fr /etc/php5/conf.d/sqlite.ini[/code] Because this extension does not exist, you can verify it by running this, you will see that there is already sqlite3.ini file there [code]root@beta:~# ls -lh /usr/lib/php5/20090626+lfs/ | grep sqlite[/code]
Read More

vzfree utility to check memory usage in OpenVZ VPS

How to, Linux, OpenSource, Resources, Tips and Tricks, Tutorials, Ubuntu, Virtual Private Server
From the official blog post Gee. It has been a while since I’ve last written here, and it will be a while again for my next post as I will be on holidays from next Monday (visiting families in Hong Kong and Taiwan). Let me share one small utility program that I wrote quite a while ago. We all know that the Linux command free(1) is pretty useless inside an OpenVZ VE, even those with meminfo virtualised. So I basically wrote this little util to grab the data from the dreadful user_beancounters and format them into something useful. It’s written in C and only depends on libc so it’s pretty light weight. It also does a little bit of analysis instead of just dumping the data, which I will explain…
Read More