Bacula-users

Re: [Bacula-users] Initiating Copy jobs after the latest job is completed

2015-03-05 11:24:22
Subject: Re: [Bacula-users] Initiating Copy jobs after the latest job is completed
From: Dan Langille <dan AT langille DOT org>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>
Date: Thu, 5 Mar 2015 11:21:27 -0500
> On Mar 4, 2015, at 2:35 PM, Dan Langille <dan AT langille DOT org> wrote:
> 
> I have an idea, and have not tried it yet.  Have you done this before?  
> Suggestions?  Ideas?
> 
> I backup to disk, then copy to tape.  The issue is how to schedule that Copy 
> To Tape.  The timing
> of the Copy To Tape jobs is critical to success.
> 
> Here is how I do that: 
> http://www.freebsddiary.org/bacula-disk-to-tape-via-sql.php
> 
> Background:
> 
> The Copy To Tape jobs run some SQL to figure out what to copy.  This SQL is 
> run
> when the Job is queued, not when the Job is started. This is the nature of 
> Copy/Migration Jobs.  If you
> queue Copy jobs at the same time as regular jobs, you will only copy the jobs 
> from yesterday, not from today.
> This seems OK, but I prefer to have the jobs copied to tape ASAP.
> 
> This means such jobs cannot be queued until after the regular jobs are 
> completed.  At present, I accomplish
> this via Schedule, but this doesn't seem optimal. Sometimes the regular jobs 
> are delayed for various reasons.
> Therefore, I want to schedule the Copy job from a job itself.
> 
> Idea:
> 
> - Create a new job, Type = Admin.  By assigning Priority appropriately, this 
> job will always run after all the regular jobs.
> 
> - The job has a RunAfter directive, which invokes a script, which then 
> issues, something like this:
> 
>    echo 'run job=CopyToTape yes' | bconsole
> 
> That seems simple enough.

FYI, this worked.

The only tweak I will do now:

Adjust the priority of the Admin Job so it runs after my Catalog backup.

> 
> But...
> 
> I want different types of copy job on different days.  So I will create these 
> schedules:
> 
> Schedule {
>  Name = "CopyToTape-Inc"
>  Run = Mon-Sat at 5:55
> }
> 
> Schedule {
>  Name = "CopyToTape-Diff"
>  Run = 2nd-5th sun at 5:55
> }
> 
> Schedule {
>  Name = "CopyToTape-Weekly"
>  Run = 2nd-5th sun at 5:55
> }
> 
> Why those times?
> 
> Because all my regular jobs run off:
> 
> Schedule {
>  Name = "WeeklyCycle"
>  Run = Level=Full         1st     sun at 5:55
>  Run = Level=Differential 2nd-5th sun at 5:55
>  Run = Level=Incremental  mon-sat     at 5:55
> }
> 
> Which leads me to these three jobs:
> 
> Job {
>  Name     = "InitiateCopyToTape-Inc"
>  JobDefs  = "DefaultJob"
> 
>  Client   = bacula-fd
>  FileSet  = "Catalog"
> 
>  Schedule = "CopyToTape-Inc"
> 
>  # This creates an ASCII copy of the catalog
>  RunAfterJob = "/usr/local/bacula/InitiateCopyToTape-Inc"
> 
>  Write Bootstrap = "/usr/local/bacula/bsr/InitiateCopyToTape-Inc.bsr"
> 
>  Priority        = 110
> }
> 
> Job {
>  Name     = "InitiateCopyToTape-Diff"
>  JobDefs  = "DefaultJob"
> 
>  Client   = bacula-fd
>  FileSet  = "Catalog"
> 
>  Schedule = "CopyToTape-Diff"
> 
>  # This creates an ASCII copy of the catalog
>  RunAfterJob = "/usr/local/bacula/InitiateCopyToTape-Diff"
> 
>  Write Bootstrap = "/usr/local/bacula/bsr/InitiateCopyToTape-Diff.bsr"
> 
>  Priority        = 110
> }
> 
> Job {
>  Name     = "InitiateCopyToTape-Full"
>  JobDefs  = "DefaultJob"
> 
>  Client   = bacula-fd
>  FileSet  = "Catalog"
> 
>  Schedule = "CopyToTape-Full"
> 
>  # This creates an ASCII copy of the catalog
>  RunAfterJob = "/usr/local/bacula/InitiateCopyToTape-Full"
> 
>  Write Bootstrap = "/usr/local/bacula/bsr/InitiateCopyToTape-Full.bsr"
> 
>  Priority        = 110
> }
> 
> 
> In short, this solution means three new jobs and three new scripts.
> 
> As mentioned above: ideas, suggestions, comments?
> 
>
> Dan Langille
> http://langille.org/
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users

— 
Dan Langille
http://langille.org/






------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>