"""
events = JobEvents() # create instance of Job class
events.job = job # save Bacula's job pointer
-# job.set_events = events # register events desired
- job.set_events(events) # register events desired
+ 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)
- return 1
# Bacula Job is going to terminate
def JobEnd(self, job):
jobid = job.JobId
client = job.Client
- job.JobReport="Python Dir JobEnd output: JobId=%d Client=%s.\n" % (jobid, client)
- if (jobid < 2) :
- startid = job.run("run kernsave")
- print "Python started new Job: jobid=", startid
- return 1
+ 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):
# normally used
noop = 1
+ def JobInit(self, job):
+ noop = 1
+ if (job.JobId < 2):
+ startid = job.run("run kernsave")
+ job.JobReport = "Python started new Job: jobid=%d\n" % startid
+ print "name=%s version=%s conf=%s working=%s" % (bacula.Name, bacula.Version, bacula.ConfigFile, bacula.WorkingDir)
+
+ def JobRun(self, job):
+ noop = 1
+
def NewVolume(self, job):
jobid = job.JobId
client = job.Client
numvol = job.NumVols;
- print "JobId=%d Client=%s NumVols=%d" % (jobid, client, numvol)
+ print job.CatalogRes
+ job.JobReport = "JobId=%d Client=%s NumVols=%d" % (jobid, client, numvol)
job.JobReport="Python before New Volume set for Job.\n"
- job.VolumeName="TestA-001"
+ Vol = "TestA-%d" % numvol
+ job.JobReport = "Exists=%d TestA-%d" % (job.DoesVolumeExist(Vol), numvol)
+ job.VolumeName="TestA-%d" % numvol
job.JobReport="Python after New Volume set for Job.\n"
return 1
self.fd = open('m.py', 'rb')
jobid = self.job.JobId
print "Open: JobId=%d" % jobid
- print "name=%s" % bacula.name
# Read file data into Bacula memory buffer (mem)
# return length read. 0 => EOF, -1 => error