Practical Extraction and Report Language/Common Gateway Interface

Simply known as PERL and CGI respectively. I decided to change my priorities in studying “Web based apps” from ASPX to Perl and CGI scripting because of the flexibility, powerfulness of this language. Also what is good about it is that I can work in different O.S platforms and I can work also both in Web, Client based or a mixture of them. My first Perl script is a couple of months ago when I made a automatic restart/redial of my DSL modem (which I revised when I changed my ISP and its modem).

#DSL Modem Script
 
#used to reboot Huawei and Prolink modems
 
#(C)opyright 2007 by Michael Angelo Yap. All Rights Reserved.
 
#!/usr/bin/perl -w
use strict;
use Net::Telnet;
use Time::Local;
 
my ($host, $port, $user, $pass, $command);
 
$host = '192.168.1.1';
$port='xxxx'; #replaced for security reasons, duhh!
$user='yyyy'; #replaced for security reasons, duhh!
$pass='zzzz'; #replaced for security reasons, duhh!
 
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime time;
 
my($vart)="$hour:$min";
 
if($vart eq "HH:MM") #replaced for security reasons, duhh!
{
my $tn = new Net::Telnet(Host => $host, Port => $port,Timeout => 10)
or die "connect failed: $!";
 
$tn->open ($host);
$tn->waitfor('/login: $/i');
$tn->print($user);
$tn->waitfor('/password: $/i');
$tn->print($pass);
 
$tn->waitfor('/\$$/i');
$tn->print('reboot');
$tn->print('exit');
}

super basic, but so very important to me!

Another Kernel Panic

A day after my birthday, My server gives me a suprisingly gift- another day long site down.

What the F!, April Fool’s Day and I just got fool again. I didn’t know how to stop this permanently even I already configured him to restart automatically in the first 20 secs of panic but still shows after rebooting. My logs are full of reboot word and still says in the screen “System Bus Error encountered. etc etc etc….”. And the most weird of all is that I also cannot connect directly to my DSL modem (it is so impossible if there is still internet connection) from outside. There are no Port forwarding config whatsoever, just the i.p (from dyndns updated regularly by the modem itself) and the port still I can’t connect!GrRr!!!

Anyway, What else can I say but to pray It would last longer than 9 days without rebooting him.

Col. Panic

Almost 19 hours of total blackout! all sites are down, what a huge mess I got when another “Kernel Panic” hits my server in just 3 weeks (this is the 3rd time). It comes to my decision to sit down on it and do something why and how this happening. With another help from my long time friend Mr. Google, I research this “mysterious phenomena” I called it that occurs in Linux machines. After reading all my recorded log files and tracing the last entry (which registered at 3/5/08 22:31:28 hrs) which says something about one of my Network Card is not acting normally and continually rejecting Rx and Tx connection!

Soon as I found out, I think he wanted to tell me that I should replace him in soonest possible and buy a new one!

Anyway, prior to this to prevent me from waiting to someone from our house(where my server also resides) to come home to REBOOT the box I modify the server to automatically reboot itself after the first 20 secs of kernel panic.

Another day go by and a relief from tragedy.