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.