Re: [Bacula-users] How to prevent to schedule a job if the same job is still running

2009-09-15 Thread Bram Vandoren
Hi Stephen,
Perhaps it's possible with this configuration:
>>>   Allow Higher Duplicates = no
>>>   Cancel Running Duplicates = yes

You can also try to change the Schedule to avoid incremental backups
starting when full backups are running. It costs a more complicated
schedule resource but it's much better tested/documented.

Cheers,
Bram.

Stephen Thompson wrote:
> 
> Hello,
> 
> This works as reported for me as well, however, what I want to have in
> the first case is for the originally scheduled job to be canceled, not
> the duplicate.  The reason being that my incrementals fall into a daily
> schedule, whereas my fulls are scheduled out-of-band, so I want the
> incremental to be canceled on the day that a full is scheduled.
> 
> Given what you all say below, this doesn't seem possible with bacula's
> Duplicate Job Control.  Correct?
> 
> thanks!
> Stephen
> 
> 
> Silver Salonen wrote:
>> On Monday 14 September 2009 15:59:24 Bram Vandoren wrote:
>>> Hi All,
>>>
>>> Silver Salonen wrote:
>>>> Hmm, I guess not then. But it has been reported several times in the
>>>> list. So, any volunteers? :)
>>> This configuration:
>>>   Allow Higher Duplicates = no
>>>   Cancel Queued Duplicates = yes
>>>
>>> Seems to work fine in my situation (some more testing is needed). It
>>> cancels the newly created duplicate job immediately.
>>>
>>> This configuration:
>>>   Allow Higher Duplicates = no
>>>   Cancel Running Duplicates = yes
>>> cancels the running job and starts the same one. If you have a job that
>>> takes more than 24h to complete a runs daily, it will never finish.
>>>
>>> Hope it helps.
>>>
>>> When I find some try I will reopen the bug report.
>>>
>>> Cheers,
>>> Bram.
>>
>> I'll try that on my servers with a few hundred jobs and report about
>> it tomorrow :)
>>
>> But as default options are "Cancel Queued Duplicates = yes" and
>> "Cancel Running Duplicates = no", the only needed option seems to be
>> "Allow Higher Duplicates = no". I myself had set "Allow Duplicate Jobs
>> = no", because I thought it includes  "Allow Higher Duplicates = no"
>> too. Whether the one option helps or not, I'll tell tomorrow.
>>
> 
> 


--
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


[Bacula-users] example python script: limiting number of concurrent full backups

2009-09-14 Thread Bram Vandoren
Hi All,
We wanted to limit the number of concurrent full backups. It's not
possible to configure it in the configuration file without affecting the
number of concurrent incremental backups. I created a small Python
script to downgrade Full backups to Incremental if more than 2 Full
backups are running.

Not much python scripting examples exist so I attached our script. Feel
free to comment or use it as a starting point for your own scripts.

Cheers,
Bram.
import MySQLdb


class IvSBacula(object):
def __init__(self):
self.conn = MySQLdb.connect (host = "",
user = "xxx",
passwd = "",
db = "bacula")

def getCursor(self):
return self.conn.cursor ()

def canRunFull(self):
	cursor = self.getCursor()
cursor.execute ("SELECT COUNT(1) FROM Job WHERE Level = 'F' AND JobStatus IN ('R', 'B', 'F', 'S', 'm', 'M', 's', 'j', 'c', 'd', 't', 'p');")
row = cursor.fetchone ()
cursor.close()
return (row[0] < 3) 
#
# Bacula Python interface script for the Director
#

# You must import both sys and bacula
import sys, bacula
from IvSBacula import *

# This is the list of Bacula daemon events that you
#  can receive.
class BaculaEvents(object):
  def __init__(self):
 # Called here when a new Bacula Events class is
 #  is created. Normally not used 
 noop = 1

  def JobStart(self, job):
 """
   Called here when a new job is started. If you want
   to do anything with the Job, you must register
   events you want to receive.
 """
 events = JobEvents() # create instance of Job class
 events.job = job # save Bacula's job pointer
 job.set_events(events)   # register events desired
 sys.stderr = events  # send error output to Bacula
 sys.stdout = events  # send stdout to Bacula
 jobid = job.JobId; client = job.Client
 numvols = job.NumVols 
 job.JobReport="Python Dir JobStart: JobId=%d Client=%s NumVols=%d\n" % (jobid,client,numvols) 

  # Bacula Job is going to terminate
  def JobEnd(self, job):
 jobid = job.JobId
 client = job.Client 
 job.JobReport="Python Dir JobEnd output: JobId=%d Status=%s Client=%s.\n" % (jobid, job.JobStatus, client) 

  # Called here when the Bacula daemon is going to exit
  def Exit(self, job):
  print "Daemon exiting."
 
bacula.set_events(BaculaEvents()) # register daemon events desired

"""
  There are the Job events that you can receive.
"""
class JobEvents(object):
  def __init__(self):
 self.ivs = IvSBacula()

  def JobInit(self, job):
 # Limit number of concurrent full jobs 
 if (job.Level == "Full"):
  if (self.ivs.canRunFull()):
  job.JobReport = "IvS: Level FULL"
  else:
  job.JobLevel = "Incremental"
  job.JobReport = "IvS: Level downgraded to Incr (too many full jobs running)"
   
  def JobRun(self, job):
 noop = 1

  def NewVolume(self, job):
 noop = 1

  def VolumePurged(self, job):
 noop = 1

  # Pass output back to Bacula
  def write(self, text):
 noop = 1

  # Open file to be backed up. file is the filename
  #  NOT YET IMPLEMENTED
  def open(self, file):
 noop = 1

  #  NOT YET IMPLEMENTED
  def read(self, mem):
 noop = 1

  #  NOT YET IMPLEMENTED
  def close(self):
 noop = 1
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] How to prevent to schedule a job if the same job is still running

2009-09-14 Thread Bram Vandoren
Hi All,

Silver Salonen wrote:
> Hmm, I guess not then. But it has been reported several times in the list. 
> So, 
> any volunteers? :)

This configuration:
  Allow Higher Duplicates = no
  Cancel Queued Duplicates = yes

Seems to work fine in my situation (some more testing is needed). It
cancels the newly created duplicate job immediately.

This configuration:
  Allow Higher Duplicates = no
  Cancel Running Duplicates = yes
cancels the running job and starts the same one. If you have a job that
takes more than 24h to complete a runs daily, it will never finish.

Hope it helps.

When I find some try I will reopen the bug report.

Cheers,
Bram.



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Spooling while Despooling?

2009-08-11 Thread Bram Vandoren
Hi Fabio,

Fabio Xarax wrote:

> I noticed that while a job is despooling no data are spooled from the
> client until despooling end. Is that right?

Yes.

> is there the possibility to let job despooling & spool data? In the
> manual I found nothing on it

No afaik it's not possible. If you have multiple jobs running
simultaneously, one job can spool data while the other is despooling.

Cheers,
Bram.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


[Bacula-users] duplicate job control

2009-07-31 Thread Bram Vandoren
Dear All,
Bacula (3.0.2) is configured to make daily backups of some systems. Full
backups unfortunately take more then one day to complete and I want to
avoid that duplicate jobs start (or are queued) before the full backup
is completed.

No duplicate job control directives are configured. If I understand the
manual correctly (perhaps it's an interpretation error of me)
http://www.bacula.org/en/dev-manual/New_Features.html#SECTION00310
this should not happen.

I had a quick look in the source code and found this code in src/dird/job.c:

bool allow_duplicate_job(JCR *jcr)
{
   JOB *job = jcr->job;
   JCR *djcr;/* possible duplicate */

   if (job->AllowDuplicateJobs) {
  return true;
   }
   if (!job->AllowHigherDuplicates) {
--> code related to "Cancel Queued Duplicates: and "Cancel Running
Duplicates" here
   }
   return true;
}

Apparently "Cancel Queued Duplicates" and "Cancel Running Duplicates"
are only evaluated when "Allow Higher Duplicates" is set to "no" - not
default. Is this an error in the documentation, code or me not correctly
understanding the manual or code?

Kind regards,
Bram Vandoren.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


[Bacula-users] Total Automation of Bacula Tape Handling

2007-05-08 Thread Bram Vandoren
Hi,
We are using Bacula in our organisation. (Single tapedrive/no 
autochanger) I am currently changing the tapes myself but want to give 
other (non IT) persons also the possibility to do this job.

When they receive an email they should insert a new tape and bacula has 
to continue with the job. It should be fool proof (eg when someone 
inserts a wrong tape it should unmount the tape and send an email again).

This should be possible with the script described in the documentation:

http://www.bacula.org/rel-manual/Tips_Suggestions.html#SECTION003816

Unfortunately the script seems not be updated for a long time and 
doesn't want to play nicely with our tape drive.

Should I try fixing the script (i already found some of the problems in 
it) or is there a better solution? I thought about writing a script 
(executed by cron every x minutes) that checks if it should do something 
depending of the output of "status storage" and the "messages" output. 
Any ideas ?

Regards,
Bram.

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users