On 2/13/25 2:59 PM, s...@riseup.net wrote:
I've used bacula for years and it's always figured out the correct Level of job to run if there are multiple scheduled.  That may have to do with these settings as well:

Allow Duplicate Jobs = no
Cancel Lower Level Duplicates = yes
Cancel Queued Duplicates = yes
Cancel Running Duplicates = no

Thanks for your insights.  The Schedule resource is documented <https://www.bacula.org/15.0.x-manuals/en/main/ Configuring_Director.html#blb:ScheduleResource> to allow a small set of <job-overrides>^

Job-overrides are specified as: keyword=value where the keyword is Level, Storage, Messages, Pool, FullPool, DifferentialPool, or IncrementalPool, and the value is as defined on the respective directive formats for the Job resource.

in a Run line, but unfortunately Maximum Bandwidth is not one.  I'm not sure there's a way to accomplish this even with the limited set of overrides available, unless someone can think of something creative with the available overrides.


Here's an idea. 💡

In your Job, configure two RunScripts sections. One before and one after.

Have a small script that takes the current jobid and the level.

If the level is "limit", set bandwidth to xxxx, if the level is "unlimited", 
set the bandwidth on the jobid to 0.


Job {
  Name = xxxxx

  [...all other Job settings...]

  RunScript {
    RunsWhen = before
    RunsOnClient = no
    FailJobOnError = no
    Command = "/path/to/bandwidth_control.sh %j %l"
  }

  RunScript {
    RunsWhen = after
    RunsOnClient = no
    FailJobOnError = no
    Command = "/path/to/bandwidth_control.sh %j %l"
  }
}

/path/to/bandwidth_control.sh:
----8<----
#!/bin/bash

# Set some variables
# ------------------
bandwidth=xxxx
bcbin=/opt/bacula/bin/bconsole
bccfg=/opt/bacula/etc/bconsole.conf

# Parameters passed to the script
# -------------------------------
# Job is $1
# Level is $2

if [ $2 = "Incremental" ]; then
  /usr/bin/echo "Job level: $2. Limiting bandwidth to ${bandwidth}."
  echo -e "setbandwidth jobid=$1 limit=${bandwidth}\nquit\n" | ${bcbin} -c 
${bccfg}
else
  /usr/bin/echo "Job level: $2. Setting bandwidth to unlimited."
  echo -e "setbandwidth jobid=$1 limit=0\nquit\n" | ${bcbin} -c ${bccfg}
fi
----8<----

I just whipped this up in my email client, so I have not tested for errors, but 
this should do exactly what you want.

Additionally, there is zero error checking, so you might want to add some, at least to check that the right number of parameters is sent to the script.


Hope this helps,
Bill

--
Bill Arlofski
w...@protonmail.com

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to