I posted here some while back, a bash script to purge and delete volumes
that are not in the database. Baculum is a useful tool to assist with
cleaning up the database and afterwards with the script, deleting the
defunct backup files. I don't use tape so its' applicability would need to
be tested. Happy to post it again if interested.

-Chris Wilkinson

On Tue, 16 Sep 2025, 19:29 Sebastian Suchanek, <[email protected]> wrote:

> Am 16.09.2025 um 18:39 schrieb Gary Dale:
>
> > [...]
> > So I'm trying to run a bash
> > script to cycle through them to purge them.
> >
> > I've found multiple answers that suggest using a bash for loop then
> > doing something like:
> >           echo "purge volume ${volname} yes" | bconsole  - where $volname
> > is created by the for loop -
> > should work. And it does actually to a point. It will invoke the "purge
> > volume" dialogue then asks which pool to use. Inserting the pool number
> > after the volume command (e.g. echo "purge volume 2 ${volname} yes" |
> > bconsole) doesn't work either. Nor does inserting \n into the echoed
> > command at various points.
> >
> > Being able to put bconsole commands into a bash script seems like
> > something that will be generally useful but I can't find a way to make
> > it work.
> >
> > Any ideas?
>
> This works for me in a slightly different scenario:
>
> ------------------ cut here ------------------
>
> bconsole <<END_OF_COMMANDS
> release storage=LTO1-Drive
>
>
> quit
> END_OF_COMMANDS
>
> ------------------ cut here ------------------
>
> Note the "empty" lines between the lines with the release and the quit
> command which "simulate" pressing return. However, I'm not sure if you
> can use variable within this "here document" structure or if the
> variable name will be interpreted as verbatim input. In the latter case,
> you might, for example, first create a temporary script file with the
> appropriate commands and run that from your main script. (Yes, sounds
> like an ugly hack...)
>
>
> HTH,
>
> Sebastian
>
>
> _______________________________________________
> Bacula-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to