>>>>> On Mon, 29 Apr 2013 12:14:46 -0400, Conrad Lawes said: > > I wrote a little bash script that demonstrates how to query to bacula tables > in postgresql database and purge volumes for a given job. The same can be > accomplished for mysql > In the example below, I am searching for job ID 8431. > > > -----------code----------------- > #!/bin/bash > volumes=`psql -U bacula bacula -c "select distinct media.volumename from > media,jobmedia where jobmedia.mediaid = media.mediaid and jobmedia.jobid=8431 > order by media.volumename;" | grep -v volumename | grep -v '(' | grep -v > '-'` > > for vol in $volumes > do > echo "Purging volume $vol" > /usr/sbin/bconsole << EOF > purge volume=$vol > EOF > done
This is dangerous if you have more than 1 job per volume. __Martin ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users