Friday, March 14, 2008

Python script from my prevois entry

Like I say I will post my python script from my previous entry, Because I'm very2 new to pyhton (1 week to be precise) so if there's something wrong with this code..so I'm sorry, but this code work fine for me. you can see the code here it's a google doc document. Because when I try to put on this blog, it a mess...

Publish NTBackup log to Internal Web server

Creating a web based backup log for your NTBackup

NTBackup is a backup tools from microsoft, it's usually already installed on your windows
machine. After the backup finish NTBackup create a backupog, but the sucks thing is, that
we can not change the directory where NTBackup log reside. The backup log locate at
"C:\Documents and Settings\%USER%\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data"


At my office we use NTBackup to perform the system state backup, and the backup result need to be checked every morning.
Because the NTBackup run with administrator priveledges, So i need to create a way so other people can review the backup
file without login to that server. And the answer is to publish the backuplog to our internal web server.

To do that I use rsync to syncronize the backup log our Linux based web server. But there's a problem with the logfile,
after it was syncronized using rsync, the problem related with character encoding. If we open that backup log on firefox It will show funny characters (see image bellow)


To handle this problem I use python script to change the encoding.
This script also will run the rsync command and generate HTML file.
I will post this python script on my next blog.

To Configure rsync on windows see Brent Noris Homepage about installing rsync on windows
Here the part of my rsync configuration to point to the NTBackup Log directory
[backuplog]
path = C:/Documents and Settings/Administrator/Local Settings/Application Data/Microsoft/Windows NT/NTBackup/data
read only = yes

After you finish configure the rsync on your windows machine, edit your crontab, then add the python script to your crontab entry.