Monday, January 12, 2009

Slumdog Millionaire !!

Watched the movie "Slumdog Millionaire" and really liked it. It is one of those classic movies where you won't get bored of watching it. Good direction, photography, TIGHT screenplay and a new story makes it worth watching.

-- Vish.

Three mistakes of my life !! (Chetan Bhagat)

"Three mistake of my life", a book by Chetan Bhagat is an interesting read. Its a small book and can be completed within 3-4 hrs. Its an interesting story about a businessman who wants to achieve something big in his life and how his mistakes cost him, almost his life.

-- Vish.

A speech by Chetan Bhagat

A good speech from Chetan Bhagat, a writer from India. It is about how to keep yourself engaged in life and not feel bored. The moral of the story is "Always have a goal and try to keep acheiving it. Also, have a balanced life (work and family)"

http://d.scribd.com/docs/1qzpkyw5ih8sc69agzkp.pdf

-- Vish.

remsh or ssh?

You might have a centralized server that has remsh/ssh authentication setup with all the other servers in your environment. You want to write a script to, lets say, get a crontab listing of all the servers. The command below shows if you can either remsh or ssh.

=========================================
ssh -o BatchMode=yes $i /bin/truex
if [[ $? -eq 0 ]];then
echo "ssh enabled"
else
echo "remsh enabled"
fi


=========================================

-- Vish

Friday, January 09, 2009

My book library !

1. The Book Thief
A book based on a German backdrop.
2. Three cups of Tea
One Man's Mission to Promote Peace . . . One School at a Time.
3. Darfur Diaries : Stories of survival
A genocide in Darfur taking place and the world ignores it !!
4. Three mistake of my life
A book by Chetan Bhagat about three mistakes a businessman did in his life !!
5. The last lecture
A book by Randy Paush, about acheiving childhood dreams.

Script to push any script to all the servers in a unix environment

It is always helpful for any dba to have a script that can push any regularly used scripts to all the servers. In my case, we had a centralized server where have all the scripts and there was authentication setup, either remsh or ssh. The script below checks if 1) it can ping the server, 2) if it can ping it, can it ssh? 3) If it cannot ssh, can it remsh?

I run this script from Sun OS. If you run it from any other OS like linux, the ping command would be different. Change it accordingly.

Operating System : SunOS


===================== Script start ==================================

cat push_script.sh

#!/usr/bin/ksh

list=`cat /tmp/complete_server_list.lst`

for i in $list

do

ping -s $i 64 1 |grep -w "0% packet loss" # Check if we can ping the server

if [[ $? -eq 0 ]];then

ssh -o BatchMode=yes $i /bin/true # Check if ssh is enabled, if not use remsh/rcp

if [[ $? -eq 0 ]];then

scp -p /tmp/test_script $i:/tmp/test_script

else

rcp -p /tmp/test_script $i:/tmp/test_script

fi

else

echo "${i}" >> /tmp/cantping.lst

fi

done


===================== Script End==================================

A good way to list the filesystem space in MB's or GB's on a unix server

A good way to list the filesystem space in MB's or GB's on a unix server.

The following commands will give the listing of the free space on the server in descending order. In my case, I'm searching for mountpoints which have /u*. This way, I get a quick overview of the free space on the server.

HP-UX:

bdf /u* | awk '($0 !~ /ounted/ && $5 !~ /100/) {printf("%s\t%dM\n",$6,$4/1024)}' | sort -n -r +1|grep /u |grep -v "/usr"



SUN OS:

df -k /u* | awk '($0 !~ /ounted/ && $5 !~ /100/) {printf("%s\t%dG\n",$6,$4/1024/1024)}' | sort -n -r +1 |grep /u |grep -v "/usr"