Bacula-users

Re: [Bacula-users] Marking all appendable volumes "used", comments on script?

2010-03-15 13:05:47
Subject: Re: [Bacula-users] Marking all appendable volumes "used", comments on script?
From: Jari Fredriksson <jarif AT iki DOT fi>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 15 Mar 2010 19:02:38 +0200
On 15.3.2010 13:02, Administrator wrote:
> Hi
> somebody pointed me to shell scripting bacula in order to mark all 
> volumes used. Long users of bacula will certainly not find this helpfull 
> but well .. hopefully this is not starting a relevance debate ;-)
> 
> I backup on two external USB-Disks which i rotate every Week (Monday). I 
> need to mark all appendable volumes as used and did not want to use the 
> volchanger script. Instead i now query the mysql db for volumes with 
> sthe status "append" and tell bconsole to mark these as used:
> ===================
> #!/bin/sh
> MYSQL=/usr/bin/mysql
> BACULA_DB=bacula5
> BACULA_USER=bacula5
> BACULA_PASS=not24get
> BCONSOLE=/opt/bacula5/etc/bconsole
> 
> openVolumes=$(${MYSQL} -u ${BACULA_USER} -p${BACULA_PASS} ${BACULA_DB} 
> -sN -e "select VolumeName from Media where VolStatus='Append'")
> 
> rm -f updateVolumes.bacula
> for volumeName in ${openVolumes}
> do
>          echo "update volume=${volumeName} volstatus=used" >> 
> updateVolumes.bacula
> done
> ${BCONSOLE} < updateVolumes.bacula
> ======================
> I could use bconsole to query for open volumes but that would involve 
> some parsing.
> 
> Criticism is welcome

If and when you use MySQL anyway, why not just

mysql -u ${BACULA_USER} -p${BACULA_PASS} ${BACULA_DB} \
-e "update Media set VolStatus='Used' where VolStatus='Append'"


-- 
http://www.iki.fi/jarif/

Q:      What's the difference between a dead dog in the road and a dead
        lawyer in the road?
A:      There are skid marks in front of the dog.

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>