A small script for BRU

One day I noticed that our operators had been very busy making archives from the Autodesk systems and forgot to inform me. This meant that tehre was about a terabytes worth of data was sitting on our nearline storage just waiting to be run onto tape and deleted, sitting in about 60 different archives.

Archiving these Autodesk archives is boring and manual work. Each archive usually consists of two files: project_name and project_name_1.seg, and I just copy the name of the project to be the name of the backup-job, then choose the two files and run the job. And all this takes time because the GUI for BRU is not the most agile one available. So I decided to write a little script I could run, just giving the folder where the archives are as a parameter.

This is probably not very efficient, and there are many ways to make it better. But it save quite a lot of time for me.

#!/usr/bin/env bash
# 2009-11-03
# juso@iki.fi

PASSWD="passwd"
SERVER="bru.servername"

if [ -z "$1" ]; then
 echo usage: $0 directory
 exit
fi

folder=$1
cd $folder

for file in *_1.seg
do
 file2=${file%_1.seg}
 upload=`(echo ${PASSWD}
 sleep 5
 echo 'backup -j "'$file2'" -t "Full" -D "destination" -o "append" -v
["/localhost'$folder'/'$file2'", "/localhost'$folder'/'$file'"]'
 sleep 5
 exit) | bru-server.cmd username $SERVER`
 echo $upload
done

Some disclaimers: I have not actually had time to test the script exactly as is (because our Bru-server is quietly clogging away at the 25 backup jobs I fed to it a while ago), but it should work. It is also my very first stab at Bru-automation.

One Response to “A small script for BRU”

  1. Alex Morgan Says:

    This is exactly what I was looking for, thank you! The similar script in the BRU manual was chock full of errors and wasn’t working for me. This one worked like a charm :)

Leave a Reply