This post originated from an RSS feed registered with Ruby Buzz
by Michael Neumann.
Original Post: Making backups with RBackup
Feed Title: Mike's Weblog
Feed URL: http://www.ntecs.de/blog-old/index.rss?cat=ruby&count=7
Feed Description: Blogging about Ruby and other interesting stuff.
Today I wrote RBackup, my own backup program, of course in Ruby. I
am now using it instead of Flexbackup, which is a very
decent backup program written in Perl that I used before.
It creates CPIO archives (new portable format, w/o CRC), and compresses
them on the fly if desired. Note that it's all pure Ruby, so that you don't
have to install the cpio program.
You can download the sources here. Make sure that you
get both files cpio.rb and rbackup.rb. Of course it comes without any
warranties. USE AT YOUR OWN RISK!
Call this script daily (via crontab or
/etc/periodic/daily) to create daily incremental backups. When
backup_monthly is specified, it will create a full backup every
first day of the month, or in the case of backup_weekly, every
first day of the week.
Note that I'm using Find.find most of the time in the example
above instead of Dir.glob, as the latter does not include dotfiles
by default.
Why another backup program?
I wrote RBackup, as I wanted to be able to perform an arbitrary number of
incremental backups. This wasn't possible with flexbackup or at least I
didn't knew how. Furthermore, I wanted to be able to specify exactly which
files to backup and which not. For this purpose, Ruby is very powerful.