Here's a script that I use to determine available tapes as well as
tapes that are in the changer.  It's not very pretty (I've been meaning
to put it into php when I have the time) but it is functional.

The get_tapes.sh script calls the get_tapes.sql file to query the
bacula database and sends the output to a printer.  You could just as
easily set it up as a cron job to email it to someone.

Since I have excluded full tapes from the output I can tell by the
number of tapes with a value of 1 how many and which valid tapes are in
the changer and the tapes with a value of 0 are available for use and
not in the changer.

get_tapes.sh contents:
#execute this to get a list of useable tapes.
echo "    " >/etc/scripts/useable_volumes.txt
echo "    ">>/etc/scripts/useable_volumes.txt
echo "    ">>/etc/scripts/useable_volumes.txt
echo "    ">>/etc/scripts/useable_volumes.txt
echo "     1=in changer.  0=not in changer." >>
/etc/scripts/useable_volumes.txt
echo "################" >>/etc/scripts/useable_volumes.txt
echo "################" >>/etc/scripts/useable_volumes.txt

mysql bacula < /etc/scripts/get_tapes.sql
>>/etc/scripts/useable_volumes.txt

print="/etc/scripts/useable_volumes1.txt"

sed 's/^/     /g' "/etc/scripts/useable_volumes.txt"
>"/etc/scripts/useable_volumes1.txt"

lp $print

echo "Now printing to your default printer."


get_tapes.sql contents:
select Volstatus, VolumeName, InChanger from Media where VolStatus <>
'Full' \g

Sample output:


          1=in changer.  0=not in changer.
     ################
     ################
     Volstatus  VolumeName      InChanger
     Purged     dlt1    0
     Purged     dlt9    1
     Purged     dlt6    0
     Purged     dlt5    0
     Purged     dlt4    1
     Purged     dlt19   1
     Purged     dlt10   0
     Purged     dlt18   0
     Purged     dlt16   1
     Purged     dlt15   0
     Purged     dlt14   1
     Append     dlt13   1
     Purged     dlt17   0
     Purged     dlt21   0

hth.

Regards,
John Little
Hendricks Regional Health
Network Engineer




> The 'status dir' output is a good guess anyway, if I remember
> correctly.
> 
> Nevertheless, I would be interested in this information, too. 
> 
> Right now I need this for one machine, but it is not as critical as
> your
> situation. We insert the tape on the next day then, and the backup
> runs
> during the day. Not very nice, but I did not find another solution
> for it.
> 
> Roland
> 
> 
> -----Original Message-----
> From: Georg Lutz [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 25, 2005 1:57 PM
> To: [email protected]
> Subject: [Bacula-users] Show next tape
> 
> Hi,
> 
> at our the site the backup operator has to know in advance which tape
> he has
> to insert in the drive for next backup. The backup tool we used so
> far, was
> able to display the backup tape which will be used next for a
> particular
> pool.
> 
> This function is absolutely essential for us, because when backup
> takes
> place (in the night) its to late to change tapes. Apart from that,
> some of
> the tapes are off-site.
> 
> I found no such function in bacula. But perhaps I missed something?
> 
> We can't use the "status dir" output, because we manually start (via
> script) backup jobs.
> 
> 
> --
> Georg


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to