Re: running bconsole commands in bash script
"Yateen Shaligram Bhagat \(Nokia\) via Bacula-users" <[email protected]>
| Newsgroups | gmane.comp.bacula.user |
|---|---|
| Message-ID | <VI1PR07MB9407A264C40B0A586C7BFE63DB7FA@VI1PR07MB9407.eurprd07.prod.outlook.com> |
Thanks Josh !! From: Josh Fisher <[email protected]> Sent: Friday, June 20, 2025 7:54 PM To: Yateen Shaligram Bhagat (Nokia) <[email protected]>; bacula-users <[email protected]> Subject: Re: [Bacula-users] running bconsole commands in bash script CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information. On 6/20/25 08:11, Yateen Shaligram Bhagat (Nokia) via Bacula-users wrote: Hi All, We are using bacula 13.x. As part of the periodic garbage collection activity, we do purging and truncating of the stranded disk volumes (volumes that have no jobs associated with them) to conserve the disk space. We do it running a bash script that first identifies such stranded volumes (at times hundreds of them) and then it purges each volume through a "for loop" with a bconsole command as given below: for vol in `echo ${vol_list}` do echo "purge volume=$vol yes" | bconsole done A new connection will be made every time bconsole is invoked. Instead, invoke bconsole only once with something like: #!/bin/sh tmp='' plist="full inc" for pool in $plist do tmp=$tmp"list media pool=$pool"$'\n' done echo "$tmp" | bconsole However for every single iteration of the purge command in the loop above, the script connects to the bacula-dir , which seems to be very slow, hence inefficient. Is there a way to connect to the bacula-dir only once and execute the purge command for number of volumes in one go? -Yateen _______________________________________________ Bacula-users mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/bacula-users _______________________________________________ Bacula-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bacula-users