Back to Black – simple backup utility written in Ruby

Posted by admin | Posted in Tools | Posted on 09-07-2007

3

Wow, I didn’t waste that weekend, I have to say. I spend most of the time working and sleeping and coding while working. After a few weeks with Ruby I’m going to say I like it, maybe it’s not love (yet) as Java was my first and you will always remember the first one ;) but I really like it.
After couple of days coding, I have created few classes and files and hopefully my problems with loosing data all the time will disappear for good!
Every time I see a new Linux/Unix distro I’m so excited that first thing I do is to install it on my machine, just to realize later that I had something on this hard drive which could be quite useful. Anyway, I read here and there about network backups, tapes etc. but what I needed was a tool much simpler, something to gather all the files in one place, check the size and if it’s right enough to burn CD, burn it.
As I’m extending my horizons on new programming languages during the holiday period, I have decided to write something like that in Ruby.


Believe it or not , but black is good sometimes ;) , like for example “Back to Black” by Amy Winehouse which is really nice song and of course Linux console, which in my case is black too! ;) (well, almost black)

Features:

  • As you are probably aware at this point, this is a console based application
  • Gathers files from many locations
  • Keeps track of the data and copy only new files or the ones with different timestamps
  • Keeps track of the previous backups to prevent storing the same files on different CD’s
  • Is configurable with simple wizard
  • Has logging facility
  • Checks the size of the backup folder and notify the user when it exceeds preferred size
  • Checks the size of the file before adding it to the backup folder to see if it fits

More or less that’s all. Well, there are a few things someone who wants to try it should know. First, there is not much validation in place so please enter the data as specified in the examples when running the configuration utility. Second, the source is not commented in a very sophisticated way, but I think everyone who wants to tweak it a bit will find out what is where.
The utility has no name yet, so feel free to send me some if you find this tool useful at all.
The whole application consists of two main scripts, one for running configuration program and the other for running actual backup.

Installation:

This utility was written for Linux and for Linux only! Tested on Ubuntu 7.04. You would have to have ruby installed, check www.ruby-lang.org for download and installation instructions.
For the application itself just download the tar.gz folder from the link below, unpack it, and you’re ready to go!

Setup:

Simply run backupConfig.rb file (you can make it executable with chmod or run ruby filename.rb) and follow the rabbit.

Run:

Run bckp.rb similarly to backupConfig.rb, if you have ruby in place just make sure you have an -x flag set on this file or run ruby bckp.rb and you are ready to go. Before running bckp you have to run config utility to have all the settings in place.

If anyone will find it interesting, wants to learn some Ruby and would like to extend its functionality let me know and I put the files somewhere in cvs or subversion server.
Possible enhancements include:

  • GUI with GTK2 or some other Linux aware toolkit
  • some kind of notification facilities
  • launching external CD/DVD burner or similar functionality

If someone has some more ideas please feel free and let me know.

This script was written on Netbeans 6.0 M9 development version with Ruby support.

Download:

# Non-members may check out a read-only working copy anonymously over HTTP.
svn checkout http://bckp.googlecode.com/svn/trunk/ bckp

For NetBeans check out you can follow
my tutorial posted earlier on this blog!


This is my first program in Ruby which is more complicated than famous ‘hello world’ so don’t expect anything astonishing.

Java One in London!

Posted by admin | Posted in General Programming | Posted on 05-07-2007

0

Heh, my blog gets a little bit dusty!
I was thinking about writing the next entry on the 12th of July but I think I will just write a small one now, as I want to share something with everyone who doesn’t know yet! Guess what? We have a small piece of Java One in London on Thursday the 12th! Very very nice! The event will take place at 45 King William Street. I have been there a few times already and I have to tell – very nice place and very nice people! So, if you have some spare time in the morning like me, go ahead and meet me there!
You would have to register for the event and before you do, check out the agenda:

1. Start 8:30 – Registration and coffee
2. Deep dive JavaFX
3. Deep dive real-time system 2.0
4. NetBeans 6.0
5. Cool Stuff: Sun SPOT in action
6. End 13:00 – Lunch!

For more details visit the link below.
You can register in two ways, one directly through Sun Microsystems and the other via Arcadia .
http://uk.sun.com/sunnews/events/2007/jul/j1takeaway/

Of course, I imagine, it’s not going to be exactly like the proper Java One but in some ways it’s even better.
First of all, it’s FREEEEEEEEEEEEEEEEE :) and it’s in London not San Francisco, summer is s..t, it’s raining all the time and if you have summer holiday like me, leave your computer for a while and finally meet some people!
Strongly recommended!