Excellent, good to know. 
I was actually wondering why you were scripting this instead of simply having 
several Command items in the Job.
It is clear now and makes 100% sense to me.

> On 12. Jun 2022, at 00:14, Bill Arlofski via Bacula-users 
> <bacula-users@lists.sourceforge.net> wrote:
> 
> On 6/11/22 15:33, Justin Case wrote:
>> Thank you so much, Bill, for your excellent explanation. It was 100% clear 
>> to me what needs to be done.
>> I am happy to tell you that nearly all your proposals are already 
>> implemented in my setup.
>> They only bit left to do is to put your scripts in as jobs.
>> I currently have only this maintenance job:
>> Job {
>> Name = "Pruning"
>> Description = "Prune all expired volumes"
>> Type = "Admin"
>> Schedule = "EveryNight"
>> JobDefs = "DefaultJob"
>> PruneJobs = yes
>> PruneFiles = yes
>> PruneVolumes = yes
>> Enabled = yes
>> Runscript {
>> RunsWhen = "Before"
>> RunsOnClient = no
>> Console = "prune expired volume yes"
>> }
>> Priority = 12
>> AllowDuplicateJobs = no
>> }
>> Thank you again,
>>  J/C
> 
> Hey Justin, you are welcome!
> 
> One additional comment and some hopefully useful information...
> 
> I always use the 'Command =' vs the 'Console =' option in RunScripts. There 
> are a few reasons:
> 
> - All output from the script, like echo commands in bash script, print() 
> commands in Python, or stdout/stderr from commands run in the script are then 
> included in the Job's job so you can see what happened, and when just by 
> looking at the job's log. Nice and neat, all in one place.
> 
> - In a script, I have full control as to what order things run in, and I can 
> also trap errors, and exit accordingly, and fail the job if necessary.
> 
> - If you have multiple 'Console =' or 'Command =' lines in a RunScript, you 
> cannot be guaranteed as to the order in which they are called/run. This 
> information is direct from the developers, and as seen/demonstrated/proven by 
> one of my colleagues on the Support team. (Thank you Uli!) :)
> 
> - The 'Console =' command associates any output to "JobId = 0" and these 
> outputs don't always appear immediately in the joblog (ie: bacula.log in a 
> Messages{} 'Append = ' log file) ast the time they occur. Seems that they can 
> be buffered and just appear randomly roo when you type 'messages' in a 
> bconsole session.
> 
> - Additionally, these log outputs for "jobId = 0" do not get inserted into 
> the catalog database, so a bconsole "ll joblog jobid=0" will return nothing, 
> and it would not matter if it did, you'd still have no idea to which job 
> these 'console =' outputs actually occurred during.
> 
> Hope this helps!
> 
> 
> Best regards,
> Bill
> 
> -- 
> Bill Arlofski
> w...@protonmail.com <mailto:w...@protonmail.com>
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net <mailto:Bacula-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/bacula-users 
> <https://lists.sourceforge.net/lists/listinfo/bacula-users>
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to