Mailing and Telneting with PERL

There are many tutorials on the net on how to use the Net::Telnet module to write a script that will automate a telnet session. Perhaps the best place is the CPAN site itself. Though all i needed was a simple script that did the job, i had to scour through many other sites for reference. Finally i’m done with the script that will telnet to the server collect the logs and then mail it to the id that i specified.

I wrote the working version as two perl scripts. I still dont know why i did that, may be for the simplicity sake.

  • log.pl  => does the telnet to retrieve the logs and mail it to me
  • run.pl => which runs the log.pl every hour

So here is the code -

log.pl

#!/usr/bin/perl
use Telnet;
# ---------------------------
$date = `date`;
chop $date;
$mailId = "jerry\@jerrymannel.com";
$cmd = "cat in.log | mail ".$mailId." -s \"Logs - ".$date."\"  ";
# ---------------------------
$host = "192.168.1.100";
$port = "2300";
$uid = "jerry";
$pwd = "password";
open $inputLog,  ">in.log";
$box = new Net::Telnet();
$box->open(     Host => $host,
                Port => $port,
        );
$iLog = $box->input_log($inputLog);
$flag = $box->login(    Name => $uid,
                        Password => $pwd,
                );
$box->print("co");
$box->waitfor('/# $/i');
$box->print("show load;show cpu");
$box->waitfor('/# $/i');
$box->print("show log");
$box->waitfor('/# $/i');
$box->close;
# MAIL section
system $cmd;
exit

run.pl

#!/usr/bin/perl
while (1)
{
        $date = `date +%M%S`;
        chop $date;
        #print $date." - ";
        if ( $date eq "0000" )
        {
                print "Sending the mail @ - ".(`date`);
                system("./logs.pl");
        }
        sleep(1);
}

The script was run on a Linux machine. So i neednt worry about the ‘date’ command and getting the date printed out in a fashion that i needed.

icon smile Mailing and Telneting with PERL Drop in a line of you have more queries on the script. Always happy to help.

Google Chrome – First Impressions

chrome 205 noshadow Google Chrome   First Impressions

What should i comment on this browser. First thing that caught my attention was the cool technology that went into this beautiful little app. Remember the days when we used IE, then Fx came along and just tripped and toppled our whole browsing experience. Fx came up with the idea of tabs, imporved browsing experience, plugins etc. etc. You name it they had it, or rather they were ready to include that in their next realease.

I feel the same when i see Chrome or Google Chrome. Its the coolest idea that we can have for a browser at this point. A browser that doesnt crash or rather does a good crash. It never affects any of your other open sessions.

(Read the Chrome story)

The best fact – its open source. That means that even my granny can get the source code and help Google imporve it or can come out with her own Hare-Rama-Rahe-Krishna Browser for the religious kind.

After the initial interations with other users over twitter. I found that people have some common issues, worries, concerns etc etc and not to mention a funny stuff too.

Prasanth a fellow Mutineer, found the shift to Chrome taking a toll on his mental heath, it was too mentally tiring for him.

Sivaprasad was able to download the online installer, but as he was sitting behing a proxy and had to authenticate the installer didnt finish what it had started. He was kind enough to send in the fix for the problem which he found here.

For all those who need a complete offline installer, i have uploaded the same in my site and is awailable for download at this link – Chrome Download. This was Allajunaki‘s idea

Interestingly Kiruba reported and error thrown by Chrome that read - “Google Chrome has encountered a problem and needs to close. Please tell Microsoft about it”. icon biggrin Google Chrome   First Impressions

Waiting for more reactions…

(first post on/using/with Chrome)

Chrome Offline installer Download

Windows 7 – First Thoughts

I will try not to be too much biased against Windows. But will like to point out what is wrong.

Hearing the news of the Demo/Preview/Debut of Windows 7 at D6 conference by Microsoft VP Julie Larson-Green, my first reaction was, Oh NO not again!!!

fp  fp  fp  vista2bp81 Windows 7   First ThoughtsI had my concerns. Microsoft has been stealing the show with its sleeky looks and publicity. If there is somebody at the market that can sell a rickety old-bus just by repainting it, its Microsoft.

Though all the other OS-es has evolved with age, windows simply refuses to budge more or less. The system requirements just to run a basic version of their latest OS takes more than twice the power that is required to run the latest Open Source OS. The fact remains that will less overhead the Open Source counterpart gives the looks and the WOW-ness.

How far can they drive along by just adding the new features without correcting the basic problems.

XP came and by the time people got adjusted to the response time, reaction time and usability, Vista was born. Now why the hell do i have to go for double the configuration for a new OS. Then again i will be doing the same things but that is going to add another transition phase in my life. From my own personal experience, the very simple task of setting an IP which took 4-5 clicks in XP, took me 5-10min in Vista just to figure out how to get the Properties window. Though basic functionality of an OS that the user looks for needs to be kept the same across versions, Microsoft fails to comply.

If the new version is going to be more user friendly than its previous one, why do you still need to pack the age old Win-98 looks with XP? They need to realize what the other OS-es in the market are doing different to keep things abreast with feature improvements, usability and performance.

At this point they just need to stop stuffing in features into an OS. It more or less looks like a huge american burger. A bite at one end will have half of the things falling out of the other end. By the time you get used to the new tasty burger in comes a new version double the size.

“Geeky & Funny”, Should be the NEW Mantra of Technology!!!

cartoon geek Geeky & Funny, Should be the NEW Mantra of Technology!!!The very first white-paper i wrote was christened – “How to extend your tea-breaks using Scripting“. Introduction started of like this -

The ‘real’ Reason…

Like every other employee, i’m at the liberty of two tea-breaks. But you just can’t spend more than 10min on a tea-break. The work was so much that squeezing even a minute, looked like a distant dream. I would have just given anything to get that break extended.

My savior was Scripting. It helped me automate the routine manual work that was involved, and i had an extra 30 min for tea-breaks.

The question is why did i resorted to write something that was meant to be formal in such a way. I had seen couple of white-papers well written and talking about some real good technologies. Many of them carried that heavy aura of being too technical and very formal, which i felt was deterring my interest in that paper. Unless and until you are someone who is really interested in reading about that particular field of technology you wont feel like reading what that guy has written. Why does it have to be always like that?

In fact technology should be fun in learning and in presentation. When the fun factor is thrown out of the window its becomes serious, boring and well at that point people starts calling its “geeky”. Throw in a few funny statements and make it more pleasing to read and i bet you will get a better audience for the things that you want to communicate.

It can turn sloppy if you are not careful enough to make the point. The message should be loud and clear. But shouldn’t be boring. Take Al Gore’s video on Global Warming – An Inconvenient Truth – for example. Though not technical or geeky, its the best testament to what i have said. The message reached everyone. You wont feel disinterested because, he puts on his witty-shoes in between and is careful enough to avoid them so that it doesn’t start sounding bland.

Still many are prejudiced against this form of presentation and communication. Why cant we use a bit of humor to build the interest in a topic. The first reaction i got for my paper was, ‘does it have to sound so funny?’. I stood by what i believed and submitted the white paper. Felt so good. But it never got selected. But hey! who ever read the title has read the whole paper. I can guarantee that.

Many a times i wondered why do people call things geeky? Its not because it was something that they couldn’t fathom. But it’s because some one made the technology formal and boring. This applies to the online tutorials as well. Why? Why? Why? Why does all theses neat technologies have such a very formal write-ups?

So come one guys we neednt be so formal with technology and ideas. Lets make learning FUN.. icon smile Geeky & Funny, Should be the NEW Mantra of Technology!!!

The Googled Life

Logo 50wht The Googled LifeLarry and Sergey would have never thought this would happen.

Any one with the bare knowledge of the internet knows about Google. It has now more or less become a house hold name. Just like the Saans-Bahu soaps. May be i should never ever compare anything to the Saans-Bahu soaps. Its more of an insult than a credit. Now the fact is, you want some thing Google has it. It has grown over the years with innovative ideas and acquisitions. You need some thing, google it!!! It has in fact become the de facto solution to most of our searches. And searching IS googling.

The mail, integrated with a chat, integrated with a social-networking site, integrated with a photo album, integrated with a video sharing site, integrated with an online office apps…. phew! One can just be hooked on to Google for the whole day.

In fact everything that we use online, is in one way or the other “Powered by Google“.powered by google 135x35 The Googled Life

Not to mention the kind of work environment that they have and the countless eyebrows that were raised all with the same question – “Is that an office?”. Employees in the technology sector dream to work at Google.

But what really made Google, Google. Looking from a surfer’s perspective its the experience. Its like the perfect blend of coffee to make the perfect espresso. A simple page with nothing more than to let you search. No unwanted fancy stuff. More than that its the integrated environment that hooks me up with Google. The usage of a single ID to do multiple stuffs. The hustle of remembering the user ids and passwords are gone. One login and mail, messenger, album etc. etc.

So which other site offers all these – NONE. Equally likable by both techies and normal people.

Just visit the Google Products page and there is something for everyone. icon smile The Googled Life We all have been pwn3d by g00g73;

“You have been GOOGLED…”