]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/examples/python/EndJob.py
Add more contributed examples
[bacula/bacula] / bacula / examples / python / EndJob.py
index 7624766f317196281b50ee18c51ed24b9ff6be18..f32df1f2f4657ad5977eae158fc25463e8c57fee 100644 (file)
@@ -1,11 +1,11 @@
 import bacula
 
-def EndJob(j):
-    jobid = bacula.get(j, "JobId")
-    client = bacula.get(j, "Client") 
-    bacula.set(jcr=j, JobReport="Python JodJob output: JobId=%d Client=%s.\n" % (jobid, client))
-    if (jobid < 5) :
-       startid = bacula.run(j, "run kernsave")
-       print "Python started jobid=", startid
+def EndJob(jcr):
+     jobid = jcr.get("JobId")
+     client = jcr.get("Client") 
+     jcr.set(JobReport="Python EndJob output: JobId=%d Client=%s.\n" % (jobid, client))
+     if (jobid < 2) :
+        startid = bacula.run("run kernsave")
+        print "Python started new Job: jobid=", startid
 
-    return 1
+     return 1