Bacula-users

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

2010-03-16 04:13:37
Subject: Re: [Bacula-users] Marking all appendable volumes "used", comments on script?
From: Administrator <admin AT bbs1emden DOT de>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 16 Mar 2010 09:11:37 +0100
Am 15.3.2010 18:02, schrieb Jari Fredriksson:
> 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'"
>    
Thanks for comment. I am not sure if this suffice. Maybe bacula is 
writing some other attributes under certain cirkumstances in any other 
table? Reading the DB should have no side effects, but saves me some 
parsing. Are you sure that updating this attribute is enough and does 
not show side effects?

M. Müller

------------------------------------------------------------------------------
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>