kaybee.org  
  Home  
  KickstartWeb  
  AutoScrapbook  
  ImageBackup  
  PerlTW  
  Whole-House Audio  
  Fan Control  
  ProjectAdmin  
  mp3Rip  
  Logwatch  
  Linux  
  Books  
  Donations  

ImageBackup

This is a small Perl script to create backup CDs out of images. I like to organize my digital pictures into a directory structure based on image content and subject. I don't store them by date. This makes it nice to find pictures, but difficult to back them up without using traditional incremental backup software and/or backing up some images more than once.

Although this program is made to work well with AutoScrapbook, it can work with any directory of images. You run the program and specify a base directory. The directory is processed recursively and any images are mirrored into a staging area. Once enough images are in the staging area, the program will (optionall) run AutoScrapbook to create a set of web pages specifically for that disc of images. It will then create an ISO image that you can burn to CD when convenient. This script is made to work on Linux, but could work on other systems with a bit of modification.

Once a disc has been created, the list of images that were on that disc is stored in a hidden data file in the base directory specified. You can then run ImageBackup on that directory again. Any images not included in any previous backups will be mirrored to the (now empty) staging directory. If the directory fills, another ISO will be generated. If not, the staging directory will remain partially-filled. You can then run ImageBackup regularly (i.e. from cron even) and new images will be added to the staging directory as they are found. Whenever the disc is full enough, an ISO is generated, and the whole process starts over.

Installation/Use

To use the program, simply download the program below and place it somewhere on your system. If your Perl interpreter is not in /usr/bin/perl, you will have to edit the first line of the file.

Edit the program and change any of the variables near the top that need to be changed.

Then, simply run the program with a directory name as a parameter. You should always enter the same base directory name for good results. If, for example, you run ImageBackup on ~/pictures and created a backup CD, you should always run it on the same directory from then on.

Download

You can download Version 1.8 (April 6, 2004) Here.

Automatic Runs

You can have this script run automatically -- say once per week. Just run this script from cron (on Red Hat Linux, for example, just place this in /etc/cron.weekly):

#!/bin/bash

email="kirk@kaybee.org"
image_backup="/home/kirk/projects/misc/image_backup.pl"
DIRS="/export/share/pictures"
TEMPDIR="/home/kirk/tmp"

mkdir -p "$TEMPDIR"

for dir in $DIRS ; do
   echo "Processing directory $dir"
   echo
   iso=`$image_backup $dir 2> "$TEMPDIR/image_backup.errors" | grep '^ISO Image Ready:'`
   if [ $? == 0 ] ; then
      echo "$iso"
      mail -s "$iso" $email < /dev/null
      exit 0
   elif [ $? == -1 ] ; then
      echo "Not enough images yet..."
      exit -1
   else
      echo "ERROR running image backup!" >&2
      mail -s 'Image backup errors!' $email < "$TEMPDIR/image_backup.errors"
      exit 1
   fi
done

Now you will receive an email whenever a new ISO image is available or if there are any errors. Note that if you configure ImageBackup to use AutoScrapbook to create an index on the backup CDs, you must have already run AutoScrapbook on the source directories if you are running ImageBackup non-interactively. If you haven't, then picture descriptions will be requested during the cron job, which won't work too well.

This page last modified Tue Apr 6 08:05:41 2004 Copyright 2014 Kirk Bauer