Hello. This is absolutely perfect. Thank you very much!
Regards, Florian Am 15.09.2014 um 18:37 schrieb Andrea Conti: > Hello, >> I will probably do this using an Admin Job, but I am unsure how to write >> a command for the update to happen. >> I don't have much experience with Unix scripting. > In order to update the status of a volume you can either pipe an update > command through bconsole or access the database directly. > > Personally I find that going through bconsole, while technically > cleaner, is extremely cumbersome (mainly because it is not that easy to > find out exactly which volumes you need to update without doing a lot of > output parsing and possibily even some queries), so I went the database way. > > Just to give you an idea, this is what I use in my setup in order to > manually rotate the active volume in my pools at the beginning of every > month: > > -------------------- > Job { > Name = "MarkDiskVolumeUsed" > JobDefs = "DefaultJob" > Type = "Admin" > FileSet = "Catalog" > Schedule = "sched.MF.00" > RunBeforeJob = "/usr/libexec/bacula/mark_disk_volumes_used <db_name> > <db_user> <db_passwd>" > Priority = 1 > } > -------------------- > > > The "sched.MF.00" schedule is such that this job is run at the > *beginning* of the month, immediately before any backup jobs that will > write to one of the affected pools. I find it easier this way than to > run at the end of the month, as it is easier to predict the start time > than the end time of backup jobs; however either can be done by choosing > the right schedule and priority relative to your backup jobs. > > This is the "mark_disk_volumes_used" script: > > -------------------- > #!/bin/sh > > if [ $# -lt 3 ]; then > echo "Usage: $0 <dbname> <dbuser> <dbpassword>" > exit > fi > > for pool in <list_of_pools>; do > STATEMENT="update media set volstatus='Full' where poolid=(select > poolid from pool where name='${pool}') and volstatus='Append' and > voljobs > 0 and volbytes > 5000000000;" > echo "${STATEMENT}" | PGPASSWORD="$3" psql -U $2 $1 -f - > done > -------------------- > > It will take the database connection parameters on the command line and > will set every volume in 'Append' status within one of the pools listed > in <list_of_pools> and with at least 5GB of written data to 'Full'. > > The filter on the volume size is there so that you can have more than > one appendable volume within each pool (either because of preallocation > or auto-recycling), but only the one which has actually been used for > backups will be marked full; you may need to adjust the amount based > upon your installation and backup schedule. > > The script above is for a postgreSQL database; if you are using > something else you will have to update the next-to-last line with the > appropriate command to execute a given query with the right user > credentials. > > HTH, > andrea ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users