Bacula-users

Re: [Bacula-users] Write spooled data to 2 volumes

2011-07-17 16:11:54
Subject: Re: [Bacula-users] Write spooled data to 2 volumes
From: Adrian Reyer <bacula-lists AT lihas DOT de>
To: Guy <guy AT britewhite DOT net>
Date: Sun, 17 Jul 2011 22:08:25 +0200
Hi Guy,

On Sun, Jul 17, 2011 at 06:38:46PM +0100, Guy wrote:
> I would be interested in seeing those scripts. I think I could adapt them for 
> virtual full and other copy jobs I would like to implement. 

Using Virtual Full, Migration and Copy jobs had been the reason for
the used wrapper script.
Known restrictions of my setup:

If you schedule other jobs using 'NextPool' the same time, you will end
up with something messy. Don't do it.

I attached the relevant part of my configs as sample how to use the
script. For easier reading I renamed my Pools to
DiskPool
TapePool1
TapePool2
As the VirtualFull Backups are scheduled directly by the normal
scheduler stuff, DiskPool is my default 'NextPool'. The 'LIMIT 50' is
just a safeguard to limit the number of jobs. You can alter it as you
like. As the jobs for copying are selected when the Schedule job 'ends'
and selects all non-copied jobs at that time you might end up copying
jobs multiple times if the jobs run into each other.
Be aware, the Pool definition has to be the only pool definition in a
single file as every occurence of 'NextPool' will be replaced. For me
this is no issue as I have every definition in a seperate file anyway.
Additionally it is 'NextPool' here, not 'Next Pool', no 'next pool', no
'nextpool'. Would not be difficult to change, I simply didn't have the
need when I built the script.

The script is intended to be enhanced if I find further requirements.

I am happy to hear if it was helpful or not.

Regards,
        Adrian

Client {
  Name = Fake
  Address = localhost
  Password = "Fake"
  Catalog = MyCatalog
}

Job {
   Name = "ScheduleCopyTape1"
   JobDefs = "JobDefaultBackupFileStorage"
   Type = Admin
   Schedule = "CopyTape1"
   Client = Fake
   FileSet = Fake
   Priority = 30
   RunAfterJob = "/bin/sh -c \"/usr/local/bin/bacula_schedule_special.sh 
--job_next_pool_file /etc/bacula/pools.d/DiskPool.conf --job_next_pool 
CopyTape1 --job CopyTape1FromDiskPool --cleanup_pool DiskPool\""
}

Job {
   Name = "ScheduleCopyTape2"
   JobDefs = "JobDefaultBackupFileStorage"
   Type = Admin
   Schedule = "CopyTape2"
   Client = Fake
   FileSet = Fake
   Priority = 25
   RunAfterJob = "/bin/sh -c \"/usr/local/bin/bacula_schedule_special.sh 
--job_next_pool_file /etc/bacula/pools.d/DiskPool.conf --job_next_pool 
CopyTape2 --job CopyTape2FromDiskPool --cleanup_pool DiskPool\""
}

JobDefs {
  Name = "CopyDefaults"
  Type = Copy
  Level = Full
  Allow Mixed Priority = yes
  Messages = Standard
  Priority = 10
  Allow Mixed Priority = yes
  Client = Fake
  FileSet = Fake
  Allow Duplicate Jobs = yes
  Cancel Queued Duplicates = No
  Cancel Running Duplicates = No
  Maximum Concurrent Jobs = 100
  SpoolData = no
  SpoolAttributes = yes

  # if the job didn't start for 1 day it is aborted as we
  # backup daily it will lead to duplicate copies and eventually blocked
  # backups
  Max Start Delay = 86400
}

Job {
  Name = "CopyTape1FromDiskPool"
  JobDefs = "CopyDefaults"
  # Uses the 'NextPool' definition from FullPool for where to write the copies 
to.
  Pool = DiskPool
  Selection Type = SQLQuery
  Selection Pattern = "select a.JobId from Job AS a JOIN Pool AS b ON 
a.PoolId=b.PoolId AND b.Name='DiskPool' WHERE a.Type='B' AND a.JobID NOT IN 
(SELECT PriorJobId FROM Job AS c JOIN Pool AS d ON c.PoolId=d.PoolId AND 
d.Name='CopyTape1') ORDER BY a.StartTime ASC LIMIT 50;"
}

Job {
  Name = "CopyTape2FromDiskPool"
  JobDefs = "CopyDefaults"
  Pool = DiskPool
  Selection Type = SQLQuery
  Selection Pattern = "select a.JobId from Job AS a JOIN Pool AS b ON 
a.PoolId=b.PoolId AND b.Name='DiskPool' WHERE a.Type='B' AND a.JobID NOT IN 
(SELECT PriorJobId FROM Job AS c JOIN Pool AS d ON c.PoolId=d.PoolId AND 
d.Name='CopyTape2') AND a.EndTime>DATE_SUB(now(),INTERVAL 10 DAY) ORDER BY 
a.StartTime ASC LIMIT 50;"
}

-- 
LiHAS - Adrian Reyer - Hessenwiesenstraße 10 - D-70565 Stuttgart
Fon: +49 (7 11) 78 28 50 90 - Fax:  +49 (7 11) 78 28 50 91
Mail: lihas AT lihas DOT de - Web: http://lihas.de
Linux, Netzwerke, Consulting & Support - USt-ID: DE 227 816 626 Stuttgart

Attachment: bacula_schedule_special.sh
Description: Bourne shell script

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users