On Friday 03 June 2005 10:20 am, Josh Valmas wrote:

> Bacula does auto file naming for me, so my retention period
> (week-diff/month- full) will keep backup files around for ahwhile on the
> disk, and then recycle them the next time through.  I want to grab the most
> recent volumes that bacula records to, and plop them on a disk.  But
> because it could be server-Full-001, or server-Full-001, etc., I don't know
> how to tell the backup-to-tape fileset to grab the most recent volume, and
> leave the rest alone because I have no desire to backup EVERYTHING to tape,
> just the previous nights backup jobs.
>
> Thanks in advance for any help/ideas you guys have to offer.
> Josh V.

Here is what I did.  This will have to work for me until the clone feature 
makes it into a released version.

In the job def I have:
Run After Job = "/root/bacula_postexec.sh %v"

The %v gets expanded to the volume name.

Here is the shell script.  It is simple and gets the job done.  I could not 
get bcopy to work.  With this way you will have to restore the volume to the 
disk before you can use it.
------------------------------------------------------
#!/bin/bash

# Take the volume name from the command line
disk_volume=$1

# Take the week number from a file (we have 3 weeks of tapes)
weeknum=`cat /root/weeknum`

# Take the day of the week for the tape label
day=`date -d yesterday +%a|tr '[A-Z]' '[a-z]'`

cd /etc/bacula

# Rewind the tape -- we will have every job in the volume and don't need more
mt rewind

# Write the volume to the tape with a label
tar cvf /dev/nst0 -V oink-$day-$weeknum  /backup/$disk_volume

# This lets me know the copy finished
mt offline

# Increment the weeknum at the end of the week
if [ $weekday='sat' ]
    then
    let weeknum=$weeknum+1
    if [ $weeknum > 3 ]
        then
        weeknum=1
    fi
    echo $weeknum > /root/weeknum
fi



>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Bacula-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bacula-users


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to