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® 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users