Tuesday, December 20, 2011

LDAP SEARCH

ldapsearch -D 'eduid=,ou=people,dc=,dc=com' -w -x -b 'dc=,dc=com' -s sub -h ldap..com mail=mailtodaman@gmail.com

Sunday, October 30, 2011

Reflections on Pearl Harbor

"Reflections on Pearl Harbor " by
Admiral Chester Nimitz.

Sunday, December 7th, 1941--Admiral Chester Nimitz was attending a
concert in Washington D.C. He told there was a phone
call for him. When he answered the phone, it was President Franklin
Delano Roosevelt on the phone. He told Admiral Nimitz that he (Nimitz)
would now be the Commander of the Pacific Fleet.

Admiral Nimitz flew to Hawaii to assume command of the Pacific Fleet.
He landed at Pearl Harbor on Christmas Eve, 1941. There was such a
spirit of despair, dejection and defeat -- you would have thought the
Japanese had already won the war. On Christmas Day,1941, Adm. Nimitz
was given a boat tour of the destruction wrought on Pearl Harbor by
the Japanese. Big sunken battleships and navy vessels cluttered the
waters every where you looked. As the tour boat returned to dock, the
young helmsman of the boat asked, "Well Admiral, what do you think
after seeing all this destruction?" Admiral Nimitz's reply shocked
everyone within the sound of his voice. Admiral Nimitz said, "The
Japanese made three of the biggest mistakes an attack force could
evermake or God was taking care of America ". Shocked and surprised, the young helmsman asked, "What do mean by
saying the Japanese made the three biggest mistakes an attack force
ever made?"

Nimitz explained.
"Mistake number one: the Japanese attacked on Sunday morning. Nine out
of every ten crewmen of those ships were ashore on leave. If those
same ships had been lured to sea and been sunk--we would have lost
38,000 men instead of 3,800.

Mistake number two: when the Japanese saw all those battleships lined
in a row, they got so carried away sinking those battleships, they
never once bombed our dry docks opposite those ships. If they had
destroyed our dry docks, we would have had to tow every one of those
ships to America to be repaired. As it is now, the ships are inshallow
water and can be raised. One tug can pull them over to the dry docks,
and we can have them repaired and at sea by the time we could have
towed them to America . And I already have crews ashore anxious to man
those ships.

Mistake number three: every drop of fuel in the Pacific theater of war
is in the ground storage tanks five miles away over that hill.
One attack plane could have strafed those tanks and destroyed our fuel
supply.

That's why I say the Japanese made three of the biggest mistakes an
attack force could make or God was taking care of America " .

I've never forgotten what I read in that little book. It is still an
inspiration as I reflect upon it. In jest, I might suggest that
because Admiral Nimitz was a Texan, born and raised in Fredricksburg ,
Texas --he was a born optimist. But anyway you look at it--Admiral
Nimitz was able to see a silver lining in a situation and circumstance
where everyone else saw only despair and defeatism. President
Roosevelt had chosen the right man for the right job. We desperately
needed a leader that could see silver linings in the midst of the
clouds of dejection,despair and defeat.

Friday, October 21, 2011

Change default gateway in linux

ifconfig eth1:0 192.168.0.121 up

route del default gw

route add default gw

Wednesday, October 12, 2011

Crontab tutorials

Crontab

Commands
#crontab -e Edit your crontab file, or create one if it doesn't already exist.
#crontab -l Display your crontab file.
#crontab -r Remove your crontab file.
#crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)

File
#crontab -e
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

• * in the value field above means all legal values as in braces for that column.

Example:-
Q1. How can I remove all log messages at 6:30 PM daily?
Ans. 30 18 * * * rm /home/user/tmp/*
Q2. How can I remove all log messages at 6:30 only on (Sat- Sun)?
Ans. 30 18 * * 6-7 rm /home/user/tmp/*
Q3. How can I remove all log messages on 1st, 10th and 15th of month Oct.?
Ans. 30 18 1,10,15 10 * rm /home/user/tmp/*
Q4. How can I remove all log messages after every 15 mins?
Ans. 15,30,45,59 * * * * rm /home/user/tmp/*

Friday, October 7, 2011

People

I have seen many people, who born MAD, lives MAD, and dies MAD. They don't know what is brain?
I have seen many people, who born SAD, looks SAD, and dies SAD. They don't know what is life?
I have seen many people, who tell lies, listen lies, and think lies. They don't know what is truth?
I have seen many people, who born angry, lives angry, and dies angry. They don’t know what is love?
I pray for those people, at least they should enjoy 5 mins of their life.

Tuesday, September 20, 2011

Bulk mail shell script

#!/bin/bash -x
#Thank God
EMAIL_LIST=/root/script/email_list.txt
RESUME_PATH=/root/script/RESUME/pdftest.pdf
NAME_OF_RESUME=Damanjeet.pdf
BODY_CONTENTS_FILE=/root/script/RESUME/BODY_CONTENTS_FILE.txt
SUBJ="Send mail from Unix with file attachments"
CC=mailtodaman@gmail.com
for TO in `cat $EMAIL_LIST`;do
(cat $BODY_CONTENTS_FILE ;uuencode $RESUME_PATH $NAME_OF_RESUME )| mail -s "$SUBJ" -c $CC mailto @gmail.com $TO
done

Migrate Mdaemon user to zimbra

#Thank God
#RUN THIS SCRIPT FROM ZIMBRA USER
IFS=$'\n'
echo "This script is written by Damanjeet."
for i in `cat Accounts.csv | grep @xyz.com`; do
CHECK=`echo $i | grep @xyz.com`
#echo $i
if [ "$CHECK" == "" ]; then
echo
else
#echo $CHECK
EMAIL_ID=` echo $CHECK|awk -F\, '{ print $1}'`
#| awk -F\" '{print $2}'`
PASSWORD=`echo $CHECK|awk -F\, '{ print $6}'`
#| awk -F\" '{print $2}'`
echo "E-mail $EMAIL_ID PASSWORD $PASSWORD"
#UNCOMMENT BELOW LINE
zmprov ca $EMAIL_ID $PASSWORD
fi
done

Sed to remove space

sed "/^[press space and then tab]/d" file_name

Wednesday, August 17, 2011

The art of public speaking

A renowned Management Guru entered a large lecture hall to deliver a lecture on Motivation to the employees of a large industrial organization.

To his horror he found that the large hall was empty except for a young man seated in the front row.

The Management Guru asked the solitary audience who he was.

“I am a Cook in the Industrial Canteen,” said the young man.

The Management Guru, pondering whether to speak or not, asked the Cook, “You are the only one here. Do you think I should speak or not? Tell me frankly, should I deliver my lecture?”

The Cook said to the Management Guru: “Respected Sir, I am a simple man and do not understand these things. But, if I came into the Dining Hall and saw only one man sitting there, I would certainly give him food.”

The Management Guru took the Cook’s insightful answer to heart and with full gusto began to deliver his lecture.

He spoke passionately for over two hours delving in great detail on each and every aspect of the theory and practice of Motivation.

Immensely proud after his virtuoso performance, the Management Guru felt highly elated, on top of the world, and wanted his audience to confirm how fantastically illuminating and effective his lecture had been.

So the Management Guru pompously asked the Cook, “How did you like my lecture?”

The Cook answered, “Respected Sir, I told you already that I am a simple man and do not understand these things very well. However, if I came into the dining hall and found only one man sitting there I would feed him, but I wouldn’t give him all the food I had prepared in the kitchen.”

Wednesday, August 10, 2011

Good one!!

A group of alumni, highly established in their careers, got together to visit their old university professor. Conversation soon turned into complaints about stress in work and life.

Offering his guests coffee, the professor went to the kitchen and returned with a large pot of coffee and an assortment of cups -porcelain, plastic, glass, crystal, some plain looking, some expensive, some exquisite - telling them to help themselves to hot coffee.

When all the students had a cup of coffee in hand, the professor said: "If you noticed, all the nice looking expensive cups were taken up, leaving behind the plain and cheap ones. While it is but normal for you to want only the best for yourselves, that is the source of your problems and stress.

What all of you really wanted was coffee, not the cup, but you consciously went for the best cups and were eyeing each other's cups.

Now if life is coffee, then the jobs, money and position in society are the cups. They are just tools to hold and contain Life, but the quality of Life doesn't change. Some times, by concentrating only on the cup, we fail to enjoy the coffee in it."

Don't let the cups drive you... Enjoy the coffee instead

Wednesday, July 20, 2011

How to close port in linux?

lsof -i -n | grep port
kill -9 PROCESS ID

Monday, July 18, 2011

Quote

"As for worrying about what other people might think - forget it.

They aren't concerned about you. They’re too busy worrying about what you and other people think of them."

-- Michael le Boeuf

Sunday, July 17, 2011

Be thankful in life....

Heavy rains remind us of challenges in life. Never ask for a lighter rain. Just pray for a better umbrella. - That is attitude.



When flood comes, fish eat ants and when flood recedes, ants eat fish. - Only time matters. Just hold on, God gives opportunity to everyone!



Life is not about finding the right person, but creating the right relationship, it's not how we care in the beginning, but how much we care till the very end.



Some people always throw stones in your path. It depends on what you make with them. A Wall or a Bridge? - Remember you are the architect of your life.



Search for a beautiful heart, but don't search for a beautiful face. Coz beautiful things are not always good, but good things are always beautiful.



It’s not important to hold all the good cards in life. But it’s important how well you play with the cards you hold.



Often when we lose all hope & think this is the end, God smiles from above and says, 'relax dear it’s just a bend, not the end.' - Have faith and have a successful life.



One of the basic differences between God and humans is, God gives, gives and forgives. But the human gets, gets, gets and forgets.



Be thankful in life....

Wednesday, July 13, 2011

The Ideal Personality

1/ Never Critics.
2/ Love each and every thing in the world.
3/ Always happy in all the situations.
4/ Good listener.
5/ Good Son, brother, Father, and Friend.
6/ Always helping.
7/ Speak only when needed.
8/ Never ill
9/ Take care of food habit.
10/ Straight forward
11/ Never jealous to see other happiness.
12/ Never think negative.
13/ Tolerance
14/ Remember name of all the people who meet.
15/ Self-discipline
16/ The ability to learn and profit from past mistakes, and quickly refocus on an improved future.
17/ Respect of other people time.
18/ Always smile on face.
19/

Life

Wednesday, April 6, 2011

Who will cry when you will die???

A person is always thinks that he is one of the valuable person and everyone loves him. In his life, he always tries to keep everyone happy.

But what do you think, who will cry when you will die? Parents? Spouse? Your Children??? Actually nobody will cry, if anyone cry it is because of you are the part of his/her life. And as time goes forward, everyone will forget you. Lets start with parents, they will not be present when you will be on death bed. Your Spouse? Will be continued...