Thursday, October 18, 2007

perl script for ftp backup



root@srvsun01 # cat /usr/scripts/backup.pl
#!/usr/bin/perl
use Net::FTP;
#my $ftp = Net::FTP->new("172.16.39.7");
#$ftp->login("backupadmin@foo.bar.edu","foobar");
my $host="172.16.39.7";
my $directory="pub";
($a,$d,$d,$day,$month,$yearoffset,$r,$u,$o) = localtime();
$year = 1900 + $yearoffset;
$backupdate= "$day-$month-$year";
print $backupdate;
$ftp=Net::FTP->new($host,Timeout=>240) or $newerr=1;
push @ERRORS, "Can't ftp to $host: $!\n" if $newerr;
myerr() if $newerr;
print "Connected\n";

$ftp->login("backupadmin@foo.bar.edu","foobar") or $newerr=1;
print "Getting file list";
push @ERRORS, "Can't login to $host: $!\n" if $newerr;
$ftp->quit if $newerr;
myerr() if $newerr;
print "Logged in\n";

$ftp->binary;
$ftp->put("backup-$backupdate.tar.gz");
$ftp->quit;

Sunday, October 07, 2007

Solaris 10.3 Installation on Dell Latitude 620

My uncle was kind enough to temporarily provide me with a Dell Latitude D620. Now that I'm in Doha and have little else to do other than job hunting, I decided to install Solaris 10.3 on it. Things weren't easy initially. The installation would never cross the grub stage . Finally browsing through web forums , it was pointed out that the dual-core is not supported. So I disabled that and continued with the installation. There were no other hitches during the installation.

Then at the reboot, it didn't seem to proceed after grub again. This time I had to add "kernel/unix" to the kernel line in the grub entry for solaris boot, i.e.

kernel /platform/i86pc/multiboot
into
kernel /platform/i86pc/multiboot kernel/unix -v

That did it and the system booted fine. It was so nice to see a good GUI for Solaris. The last time I worked on Solaris, it was on those horrible Netra 1125 boxes which don't even have the mercy to display anything on screen other than via serial console or ssh/telnet. We did have an Enterprise E450 too, but the GUI for that wasn't that impressive either.

Anyway Solaris 10.3 looks really nice, clean. Video card and NIC worked out of the box. Only the sound remains to be installed. Will do that tomorrow.
And btw, firefox doesn't seem to be there in the default installation, only mozilla is installed. So I got a package of firefox for solaris on x86 and installed it. Now I feel much at home here too..