Tuesday, May 22, 2012

How to assign a file handle to a subroutine.
==============================

my $FH;
open($FH,"< /tmp/text");
my_print(\*$FH);
exit(0);
sub my_print {
    my $FH = shift;
    my @arr = <$FH>;
    print @arr;
}

Monday, May 21, 2012

More details on git and subversion integration :
http://metypefunny.blogspot.com/2009/01/git-it-together-with-subversion.html




Steps to create git repository on RHEL 5.x system :
 rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
 yum install --enablerepo=webtatic git-all
 git
 mkdir src
 cd src/
 git init
 cp ../savecmdlog.pl.bak savecmdlog.pl
 git
 git status
 git add savecmdlog.pl
 git commit
 git config --global user.name "Manas"
 git config --global user.email manas_khandeshe@symantec.com
 git commit --amend --reset-author
 git log
 git diff
 git commit -a -m 'hard coding of sql statements'

Tuesday, May 8, 2012

How to recover from GRUB not Found error :
http://searchenterpriselinux.techtarget.com/tip/Its-an-easy-fix-to-clean-up-a-GRUB-error-on-your-Linux-server?asrc=EM_NLN_17277113&track=NL-795&ad=870966&


Monday, May 7, 2012

validation for 5GB free space in shell for all platforms

Simple but very useful:

#-------------------------------
# Validation for 5GB free space.
#-------------------------------
#AIX OS
if [ `uname` = "AIX" ]
then
    if [ `df -g $op_path | awk ' { print $2 } ' | tail -1` -lt 5 ]
    then
        echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
        exit
    fi
fi
#HP-UX
if [ `uname` = "HP-UX" ]
then
    val=`bdf $op_path | awk ' { print $4 } ' | tail -1`
    val_gb1=`echo "scale=2; $val/1024" | bc`
    val_gb=`echo "scale=2; $val_gb1/1024" | bc`
    #if [ $val_gb \< 5 ]
    if [ $val_gb -lt 5 ]
    then
        echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
        exit
    fi
fi
#SunOS
if [ `uname` = "SunOS" ]
then
    val=`df -k $op_path | awk ' { print $4 } ' | tail -1`
    val_gb1=`echo "scale=2; $val/1024" | bc`
    val_gb=`echo "scale=2; $val_gb1/1024" | bc`
    #if [ $val_gb \< 5 ]
    if [ $val_gb -lt 5 ]
    then
        echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
        exit
    fi
fi
#Linux
if [ `uname` = "Linux" ]
then
    val=`df -k $op_path | awk ' { print $4 } ' | tail -1`
    val_gb1=`echo "scale=2; $val/1024" | bc`
    val_gb=`echo "scale=2; $val_gb1/1024" | bc`
    if [ $val_gb \< 5 ]
    then
        echo "Minimum of 5GB of free space should be presnt at $op_path to run the script"
        exit
    fi
fi