Thursday, March 24, 2011

Zombie Process Linux

A process can be sleeping in kernel code. Usually that's because of faulty hardware or a badly written driver- or maybe a little of both. A device that isn't set to the interrupt the driver thinks it is can cause this, for example- the driver is waiting for something its never going to get. The process doesn't ignore your signal- it just never gets it.
A zombie process doesn't react to signals because it's not really a process at all- it's just what's left over after it died. What's supposed to happen is that its parent process was to issue a "wait()" to collect the information about its exit. If the parent doesn't (programming error or just bad programming), you get a zombie. The zombie will go away if its parent dies- it will be "adopted" by init which will do the wait()- so if you see one hanging about, check its parent; if it is init, it will be gone soon, if not the only recourse is to kill the parent..which you may or may not want to do.
* Finally, a process that is being traced (by a debugger, for example) won't react to the KILL either.

We can find out zombie process by :-
Use top or ps command:

# top
OR
# ps aux | awk '{ print $8 " " $2 }' | grep -w Z

#ps -el | grep Z

How do I kill zombie process?
You cannot kill zombies, as they are already dead. But if you have too many zombies then kill parent process or restart service.

You can kill zombie process using PID obtained from any one of the above command. For example kill zombie proces having PID 4104:
# kill -9 4104
*Please note that kill -9 does not guarantee to kill a zombie process

How do I automate zombie process killing?
Write a script and schedule as a cron job.

 `ps jauxww | grep Z | grep -v PID | awk ‘{print $3}’`; do for every in `ps auxw | grep $each | grep cron | awk ‘{print $2}’`; do kill -9 $every; done; done

Wednesday, March 23, 2011

Firefox 4 for fedora 14


#vi /etc/yum.repos.d/firefox.repo

# Place this file in your /etc/yum.repos.d/ directory

[fedora-firefox4]
name=Firefox 4 Web Browser
baseurl=http://repos.fedorapeople.org/repos/spot/firefox4/fedora-$releasever/$basearch/
enabled=1
gpgcheck=0

[root@rajat yum.repos.d]# yum install firefox4
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
fedora-firefox4                                          | 3.0 kB     00:00     
fedora-firefox4/primary_db                               |  15 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package firefox4.i686 0:4.0-2.fc14 set to be installed
--> Processing Dependency: gecko-libs(x86-32) = 2.0-1 for package: firefox4-4.0-2.fc14.i686
--> Processing Dependency: libmozalloc.so for package: firefox4-4.0-2.fc14.i686
--> Running transaction check
---> Package xulrunner2.i686 0:2.0-1.fc14 set to be installed
--> Processing Dependency: sqlite >= 3.7.4 for package: xulrunner2-2.0-1.fc14.i686
--> Running transaction check
---> Package sqlite.i686 0:3.7.4-1.fc14 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch        Version             Repository              Size
================================================================================
Installing:
 firefox4          i686        4.0-2.fc14          fedora-firefox4         17 M
Installing for dependencies:
 xulrunner2        i686        2.0-1.fc14          fedora-firefox4        8.7 M
Updating for dependencies:
 sqlite            i686        3.7.4-1.fc14        fedora-firefox4        329 k

Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       1 Package(s)

Total download size: 26 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
fedora-firefox4/prestodelta                              | 8.9 kB     00:00     
Processing delta metadata
Package(s) data still to download: 26 M
(1/3): firefox4-4.0-2.fc14.i686.rpm                      |  17 MB     18:54     
(2/3): sqlite-3.7.4-1.fc14.i686.rpm                      | 329 kB     00:18     
(3/3): xulrunner2-2.0-1.fc14.i686.rpm                    | 8.7 MB     08:43     
--------------------------------------------------------------------------------
Total                                            16 kB/s |  26 MB     28:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : sqlite-3.7.4-1.fc14.i686                                 1/4 
  Installing     : xulrunner2-2.0-1.fc14.i686                               2/4 
  Installing     : firefox4-4.0-2.fc14.i686                                 3/4 
  Cleanup        : sqlite-3.6.23.1-1.fc14.i686                              4/4 

Installed:
  firefox4.i686 0:4.0-2.fc14                                                    

Dependency Installed:
  xulrunner2.i686 0:2.0-1.fc14                                                  

Dependency Updated:
  sqlite.i686 0:3.7.4-1.fc14                                                    

Complete!
[root@rajat yum.repos.d]# 

Application-->Internet-->Firefox4



:)

Wednesday, March 16, 2011

Enable Quota on RHEL/CentOS

Quota is used for limiting the disk usage for users or groups.

###To verify that the quota is enabled in the kernel###
#grep CONFIG_QUOTA /boot/config-`uname -r`
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@rajat rajat]#

Create user :
#useradd rajat
#passwd latar


Edit /etc/fstab :
From :
/dev/sda5 /home ext3 defaults 1 2
To :
/dev/sda5 /home ext3 defaults,usrquota,grpquota 1 2


Remount the disk (make sure it’s not in use) :
#mount -o remount /home

Check if usrquota and grpquota are enabled :
#mount | grep /home

Create quota files :
#quotacheck -cvug /home

This creates /home/aquota.user and /home/aquota.group

Check quota :
#quotacheck -avug

Enable quota for user1 :

#edquota user1
Edit soft and hard limits (1000 = 1 MB) or inode values.

Check the quota for user1 :
#quota user1

Enable quota :
#quotaon -avug

In addition :

Through a cron, run everynight when the filesystem is not used :
#quotaoff -avug && quotacheck -avug && quotaon --avug

Get quota stats :
#repquota -a

Wednesday, March 9, 2011

Install your own Video chat room CentOS AMIs

wget http://download.camfrog.com/get.php?type=fasl

[root@rajat ]# yum localinstall camfrogserver-5.0-4.noarch.rpm --nogpgcheck
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Local Package Process
Examining camfrogserver-5.0-4.noarch.
rpm: camfrogserver-5.0-4.noarch
Marking camfrogserver-5.0-4.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package camfrogserver.noarch 0:5.0-4 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch       Version     Repository                       Size
================================================================================
Installing:
 camfrogserver     noarch     5.0-4       /camfrogserver-5.0-4.noarch     3.8 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total size: 3.8 M
Installed size: 3.8 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : camfrogserver-5.0-4.noarch                               1/1
Certificate generated successfully, cert file name: /etc/camfrogserver.d/cert.pem, configuration file /etc/camfrogserver.d/cf_server.conf updated

***

Thank you for installing Camfrog Advanced Server for Linux.

Before you start Camfrog Server for the first time you must agree to the Camfrog Terms Of Service (TOS) and EULA at /etc/camfrogserver.d/CamfrogTOS.txt.
The TOS may be updated.  Please visit http://www.camfrog.com/terms.phtml for the most current TOS.
If you disagree with the Camfrog EULA or Terms of Service do not start Camfrog Server and uninstall it immediately.

***

The default config file is located in /etc/camfrogserver.d/cf_server.conf.sample

For the /etc/rc.d/init.d/camfrogserver startup script configuration settings please check /etc/sysconfig/camfrogserver.

Use the "service camfrogserver start" command to start server.


Installed:
  camfrogserver.noarch 0:5.0-4                                                 

Complete!
[root@rajat ]# cd /etc/camfrogserver.d
#cp cf_server.conf.sample cf_server.conf
#vi cf_server.conf
SSL_certificate_param=SiChE8xIyj3coZIATfXvf
# Enable remote access protocol. You can control your server using Windows-base$
remote_control_enabled=on
# Username/password for remote console access (full server management)
remote_control_login=rajat
remote_control_password=rajat

Port to open at AWS Management Console
6000:6010 tcp
5000:15000 udp
6005 udp
5999 tcp

[root@rajat camfrogserver.d]# service camfrogserver restart
Shutting down Camfrog server:                              [  OK  ]
Starting up Camfrog server daemon:                         [  OK  ]
[root@rajat camfrogserver.d]#

Now download Camfrog Advanced Server to your PC, and  Install it

Open Camfrog Advanced Server > Server Options > Change Server :)