Back to Black - simple backup utility written in Ruby

Back to Black – simple backup utility written in Ruby

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.

3 responses on “Back to Black – simple backup utility written in Ruby

  1. ooblogger July 9, 2007 at 5:39 pm

    By the moderator:
    Downloads section has changed, this project is now available through subversion! You can see more details about the project and download the current source code from: http://code.google.com/p/bckp/

  2. Anonymous July 14, 2007 at 11:04 pm

    Hi,

    Sounds very interesting!

    Unfortunately the repository doesn’t seem to be working correctly (looks like there’s nothing there).

    After executing svn checkout http://bckp.googlecode.com/svn/trunk/ bckp nothing downloads apart from hidden .svn folder with the usual stuff

  3. ooblogger July 15, 2007 at 12:47 am

    Yeah, you’re right. I’m not a subversion guru but I have checked it and you can do the following:
    svn checkout http://bckp.googlecode.com/svn
    This one works from the command line!
    Thanks!
    Kris.

Leave a Reply