Automatically enabling/disabling removable vchanger volumes in Bacula database based on current availability

20130418 - Script re-written to utilize bconsole's "sqlquery" command to increase efficiency

Thanks to Josh Fisher for vchanger, and for recently sharing a few scripts on the Bacula mailing list which allow you to easily enable or disable all volumes in a pool, or all volumes on a vchanger magazine.

Making sure that only currently available volumes are enabled in Bacula's database solves a few issues - especially when using multiple removable magazines with vchanger.

The following script may be run manually when you swap removable media, or as a RunScript in an "Admin" type Bacula job. It will automatically determine which vchanger magazine(s) are inserted and available and will use bconsole's sqlquery command to to set the "Enabled" field in the Bacula database for all available volumes accordingly.

auto_enable_disable_vols.sh6.1 KB

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <b> <i> <u> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Enter the code without spaces and pay attention to upper/lower case.