A Bash capacity remediation report can convert reserve into a direct hold, shift, or shed action.

Program

Play the script to choose reserve and inspect the operational action.

reserve
capacity_shift_report.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash

reserve=8
if (( reserve >= 12 )); then
    action="hold"
elif (( reserve >= 6 )); then
    action="shift"
else
    action="shed"
fi
echo "reserve=$reserve $action"
#!/usr/bin/env bash

reserve=4
if (( reserve >= 12 )); then
    action="hold"
elif (( reserve >= 6 )); then
    action="shift"
else
    action="shed"
fi
echo "reserve=$reserve $action"
#!/usr/bin/env bash

reserve=16
if (( reserve >= 12 )); then
    action="hold"
elif (( reserve >= 6 )); then
    action="shift"
else
    action="shed"
fi
echo "reserve=$reserve $action"
  1. reserve ← 8

    3reserve=84if (( reserve >= 12 )); then
    values this step8reserve
  2. if (( reserve >= 12 )); then

    3reserve=84if (( reserve >= 12 )); then5    action="hold"
    values this step8reserve
  3. elif (( reserve >= 6 )); then

    5    action="hold"6elif (( reserve >= 6 )); then7    action="shift"
    values this step8reserve
  4. action ← shift

    6elif (( reserve >= 6 )); then7    action="shift"8else
    values this stepshiftaction
  5. echo "reserve=$reserve $action"

    10fi11echo "reserve=$reserve $action"
    outputreserve=8 shift
    values this step8reserveshiftaction
  1. reserve ← 4

    3reserve=44if (( reserve >= 12 )); then
    values this step4reserve
  2. if (( reserve >= 12 )); then

    3reserve=44if (( reserve >= 12 )); then5    action="hold"
    values this step4reserve
  3. elif (( reserve >= 6 )); then

    5    action="hold"6elif (( reserve >= 6 )); then7    action="shift"
    values this step4reserve
  4. action ← shed

    8else9    action="shed"10fi
    values this stepshedaction
  5. echo "reserve=$reserve $action"

    10fi11echo "reserve=$reserve $action"
    outputreserve=4 shed
    values this step4reserveshedaction
  1. reserve ← 16

    3reserve=164if (( reserve >= 12 )); then
    values this step16reserve
  2. if (( reserve >= 12 )); then

    3reserve=164if (( reserve >= 12 )); then5    action="hold"
    values this step16reserve
  3. action ← hold

    4if (( reserve >= 12 )); then5    action="hold"6elif (( reserve >= 6 )); then
    values this stepholdaction
  4. echo "reserve=$reserve $action"

    10fi11echo "reserve=$reserve $action"
    outputreserve=16 hold
    values this step16reserveholdaction
reserve The reserve value is a deterministic selector, not a live capacity read.
action mapping Threshold branches map reserve to hold, shift, or shed.
report line The final line keeps the input and remediation action together.