Tuesday, September 28, 2010

Memory use by which process Centos / RHEL /Fedora

#ps aux | awk '{if ($5 != 0 ) print $2,$5,$6,$11}' | sort -k2n

Wednesday, September 22, 2010

5 Step Jboss set up RHEL/Cent OS 5.X

Step:1:-  yum install mysql mysql-server java-1.6.0-openjdk -y
Step:2:- service mysqld start
Step:3:- wget  http://sourceforge.net/projects/jboss/files/JBoss/JBoss-6.0.0.M4/jboss-as-
distribution-6.0.0.20100721-M4.zip/download
Step:4:- unzip jboss-as-distribution-6.0.0.20100721-M4.zip
Step:5:- /opt/jboss/bin/run.sh

http://yourdomain.com:8080 

Monday, September 20, 2010

Install Latest postgresql using yum from pgsqlrpms


[root@ip-173-201-21-11 ~]# wget http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# rpm -ivh pgdg-centos-8.4-2.noarch.rpm
[root@ip-173-201-21-11 ~]# yum install postgresql postgresql-devel postgresql-server postgis pgadmin postgresql-contrib
[root@ip-173-201-21-11 ~]# chkconfig postgresql on
[root@ip-173-201-21-11 ~]# service postgresql initdb
[root@ip-173-201-21-11 ~]# chkconfig postgresql on && service postgresql start
[root@ip-173-201-21-11 ~]# psql --version
psql (PostgreSQL) 8.4.4
contains support for command-line editing

#########################################
vi /var/lib/pgsql/data/postgresql.conf
# – Connection Settings -
listen_addresses = ‘*’
port = 5432

CPULOAD and send email to admin

This script is very useful for system admins, it checks Cpuload and get info of which process takes the cpuload, if cpuload is or above 70%  it sends alert email to admin
==============================
#!/bin/bash
# Shell script to monitor or watch the high cpu-load
# It will send an email to $ADMIN, if the (cpu load is in %) percentage
# of cpu-load is >= 70%
# If you have any suggestion or question please email to raviindiangnu org
# set admin email so that you can get email
# set alert level 70% is default
# you can set it to string LOAD with your value

AWK=/bin/awk
SAR=/usr/bin/sar
GREP=/bin/grep
TR=/usr/bin/tr
HEAD=/usr/bin/head
PS=/bin/ps
SORT=/bin/sort
HOSTNAME=yeswedeal.com
SED=/bin/sed
LOAD=70
CAT=/bin/cat
MAILFILE=/tmp/mailviews$$
MAILER=/bin/mail
mailto=”rajatjpatel@yeswedeal.com”
for path in $PATHS
do
CPU_LOAD=`$SAR -P ALL 1 2 | $GREP ‘Average.*all’ | $AWK -F” ” ‘{ print 100.0 -$NF}’`
echo $CPU_LOAD
if [[ $CPU_LOAD > $LOAD ]];
then
PROC=`$PS -eo pcpu,pid -o comm= | $SORT -k1 -n -r | $HEAD -1`
echo “Please check your processess on ${HOSTNAME} the value of cpu load is $CPU_LOAD % & $PROC” > $MAILFILE
$CAT $MAILFILE | $MAILER -s “CPU Load is $CPU_LOAD % on ${HOSTNAME}” $mailto
fi
done
=============================
After  end of  schedule cron job for this script like below
*/30 * * * * /bin/sh /root/cpuload.sh >/dev/null 2>&1