Monday, January 12, 2009
Slumdog Millionaire !!
-- Vish.
Three mistakes of my life !! (Chetan Bhagat)
-- Vish.
A speech by Chetan Bhagat
http://d.scribd.com/docs/1qzpkyw5ih8sc69agzkp.pdf
-- Vish.
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 !
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
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
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"