2 Release Notes for Bacula 1.37.1
4 Bacula code: Total files = 398 Total lines = 117,151 (*.h *.c *.in)
8 - Preliminary Python Event support has been added. See below for
10 A Python script will be called at particular points or conditions
11 in Bacula called Events. The currently defined Events are called:
13 StartJob, EndJob, NewVolume
15 Where StartJob is called before the RunBeforeJob, EndJob is called
16 after RunAfterJob, and NewVolume, is called before all other
17 "methods" of obtaining a new Volume name, when one is needed.
19 The Python script of the same name as the Event name (but with a .py)
20 is called from the Scripts Directory (a directive defined in the
21 Director resource). Note, both the Filename, and the name of
22 the function in the file must correspond to the Event name.
24 Once the Python script gets control, it can have access to Bacula
29 The script is called with one argument, typically called j. This
30 argument *must* be passed unchanged to each bacula function. The
31 format of the call is slightly different for reading Bacula
32 variable and for writing bacula variables. See below.
34 Bacula variables can be read with:
36 bacula.get(j, "Variable-name")
38 where j is the argument passed to the function, and Variable-name
39 is on of the following:
41 JobId, Client, Pool, Storage, Catalog, MediaType, NumVols, DirName,
42 Level, Type, Job, JobName, JobStatus
44 Bacula varibles can be set using Python keyword arguments:
46 bacula.set(jcr=j, VolumeName="xyz")
48 The two currently implemented writable "variables" are:
50 VolumeName and JobReport
52 It is possible to submit a Bacula run command with the following:
54 bacula.run(j, "run kernsave client=Matou storage=File")
56 this function returns the JobId of the job that was started. If
57 there is an error, the return value is zero.
65 jobid = bacula.get(j, "JobId")
66 client = bacula.get(j, "Client")
67 bacula.set(jcr=j, JobReport="EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
69 startid = bacula.run(j, "run kernsave")
70 print "Python started jobid=", startid
75 == File NewVolume.py ===
79 jobid = bacula.get(j, "JobId")
81 client = bacula.get(j, "Client")
82 print "Client=" + client
83 numvol = bacula.get(j, "NumVols");
84 print "NumVols=", numvol
85 bacula.set(jcr=j, JobReport="New Volume set for Job.\n")
86 bacula.set(jcr=j, VolumeName="TestA-001")
92 - Scripts Directory = <directory> name. Defines the directory from
93 which Bacula scripts will be called for events. In fact, Bacula
94 appends this name to the standard Python list of search directories,
95 so the script could also be in any of the Python system directories.
96 - In FileSet, you can exclude backing up of hardlinks (if you have
97 a lot, it can be very expensive), by using:
99 in the Options section. Patch supplied by David R Bosso. Thanks.
102 - "python restart" restarts the Python interpreter. Rather brutal, make
103 sure no Python scripts are running. This permits you to change
104 a Python script and get Bacula to use the new script.
107 - You must add --with-python=[DIR] to the configure command line
108 if you want Python support. Python 2.2 and 2.3 should be automatically
109 detected if in the standard place.
110 - With Python 2.2 version, the link of the Director gets a few linker
111 warnings due to the fact that Python pulls in some old non-secure
113 - With Python 2.3, there are a few compiler warnings.