Batch scripts often run for a named time window. Modeling the label keeps schedule decisions visible without depending on the current clock.

Program

Play the script to choose the window and see the planned schedule label.

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

window="daily"
case "$window" in
    daily) label="daily-00Z"; retention="7d" ;;
    hourly) label="hourly-15"; retention="24h" ;;
esac
echo "$label retention=$retention"
#!/usr/bin/env bash

window="hourly"
case "$window" in
    daily) label="daily-00Z"; retention="7d" ;;
    hourly) label="hourly-15"; retention="24h" ;;
esac
echo "$label retention=$retention"
  1. window ← daily

    3window="daily"4case "$window" in
    values this stepdailywindow
  2. case "$window" in

    3window="daily"4case "$window" in5    daily) label="daily-00Z"; retention="7d" ;;
    values this stepdailywindow
  3. label ← daily-00Z, retention ← 7d

    4case "$window" in5    daily) label="daily-00Z"; retention="7d" ;;6    hourly) label="hourly-15"; retention="24h" ;;
    values this stepdaily-00Zlabel7dretention
  4. echo "$label retention=$retention"

    7esac8echo "$label retention=$retention"
    outputdaily-00Z retention=7d
    values this stepdaily-00Zlabel7dretention
  1. window ← hourly

    3window="hourly"4case "$window" in
    values this stephourlywindow
  2. case "$window" in

    3window="hourly"4case "$window" in5    daily) label="daily-00Z"; retention="7d" ;;
    values this stephourlywindow
  3. label ← hourly-15, retention ← 24h

    5    daily) label="daily-00Z"; retention="7d" ;;6    hourly) label="hourly-15"; retention="24h" ;;7esac
    values this stephourly-15label24hretention
  4. echo "$label retention=$retention"

    7esac8echo "$label retention=$retention"
    outputhourly-15 retention=24h
    values this stephourly-15label24hretention
time window A time window names the period a batch job covers.
schedule label Labels make scheduled output easier to group and inspect.
retention Retention says how long outputs from that window should be kept.