Back to Knowledege base

Configuring Holidays for Job Scheduling

Setting up and maintaining the holiday calendar

Understanding the Holiday Calendar

Xi-Batch maintains a calendar of holidays that jobs can avoid when scheduling repeats.

Holiday calendar features:

  • Supports years up to 2099
  • Single system-wide calendar
  • Jobs reference via "Hday" in avoid days
  • Editable by users with appropriate privileges
  • Viewed by all users

Why Use the Holiday Calendar

Business day scheduling:

Jobs can run on working days only:

bash

# Daily at 8 AM, skip weekends and holidays
btr -t "08:00" -r Days:1 -a "Sat,Sun,Hday" daily-report.sh

Month-end processing:

Combined with Monthse, enables "last working day" scheduling:

bash

# Last working day of month
btr -t "18:00 2026-02-28" -r Monthse:1:28 -a "Sat,Sun,Hday" month-end.sh

Payroll schedules:

Ensure payroll jobs run on business days:

bash

# Biweekly on Friday, or previous working day if Friday is holiday
btr -t "15:00 Friday" -r Weeks:2 -a "Hday" payroll.sh

Viewing the Holiday Calendar

In btq:

  1. Press H
  2. View current year calendar
  3. Holidays highlighted
  4. Sundays/Saturdays may appear dimmed

Command line:

bash

# Export holiday calendar
xb-cholist > holidays.txt

Editing the Holiday Calendar

Requires: Write administration file privilege

In btq:

  1. Press H to display calendar
  2. Navigate to date using arrow keys
  3. Press S (set) to mark as holiday
  4. Press U (unset) to unmark holiday
  5. Press Q to save changes

Navigate years:

  • Press + for next year
  • Press - for previous year
  • Type year number and press Enter

Setting Up Annual Holidays

Example - US Federal Holidays 2026:

Date           Holiday
Jan 1          New Year's Day
Jan 19         Martin Luther King Jr Day
Feb 16         Presidents Day
May 25         Memorial Day
Jul 3          Independence Day (observed)
Sep 7          Labor Day
Oct 12         Columbus Day
Nov 11         Veterans Day
Nov 26         Thanksgiving
Dec 25         Christmas

In btq:

  1. Press H
  2. Navigate to each date
  3. Press S to mark
  4. Repeat for all holidays
  5. Press Q when complete

Command-Line Holiday Management

Export current holidays:

bash

xb-cholist > holidays-2026.txt

Import holidays:

bash

xb-cholist < holidays-2026.txt

Export/import format:

2026:1:1       # New Year's Day
2026:1:19      # MLK Day
2026:2:16      # Presidents Day
2026:5:25      # Memorial Day
2026:7:3       # Independence Day
2026:9:7       # Labor Day
2026:10:12     # Columbus Day
2026:11:11     # Veterans Day
2026:11:26     # Thanksgiving
2026:12:25     # Christmas

Scripted Holiday Setup

Create script to load holidays:

bash

#!/bin/bash
# load-holidays.sh

cat << 'EOF' | xb-cholist
2026:1:1
2026:1:19
2026:2:16
2026:5:25
2026:7:3
2026:9:7
2026:10:12
2026:11:11
2026:11:26
2026:12:25
2027:1:1
2027:1:18
2027:2:15
2027:5:31
2027:7:5
2027:9:6
2027:10:11
2027:11:11
2027:11:25
2027:12:24
EOF

Run annually to update holidays:

bash

chmod +x load-holidays.sh
./load-holidays.sh

Multi-Year Planning

Load multiple years at once:

bash

# Create file with 3 years of holidays
cat > holidays-2026-2028.txt << 'EOF'
# 2026
2026:1:1
2026:1:19
2026:2:16
2026:5:25
2026:7:3
2026:9:7
2026:10:12
2026:11:11
2026:11:26
2026:12:25

# 2027
2027:1:1
2027:1:18
...

# 2028
2028:1:1
...
EOF

# Load into Xi-Batch
xb-cholist < holidays-2026-2028.txt

Holiday Calendar Updates

When to update:

  • Beginning of each year
  • When company holiday schedule changes
  • When floating holidays announced

Update process:

  1. Backup existing holidays: xb-cholist > backup-$(date +%Y).txt
  2. Add new year's holidays
  3. Verify with btq H command
  4. Test with sample job using avoid days

How Avoid Days Works with Holidays

When job scheduled on holiday, moves to next business day:

Example:

Schedule: Daily 09:00, avoid Sat/Sun/Hday
Thursday (not holiday):    09:00 - Runs
Friday (is holiday):       09:00 - Skipped
Saturday:                  09:00 - Skipped
Sunday:                    09:00 - Skipped
Monday (next business day): 09:00 - Runs

For Monthse (relative to end):

Moves to earlier business day:

Schedule: Last working day, avoid Sat/Sun/Hday
Month ends Friday (holiday):    Use Thursday
Month ends Saturday (weekend):  Use Friday (if not holiday)
Month ends Sunday (weekend):    Use Friday (if not holiday)

Verifying Holiday Configuration

Test job to verify holidays working:

bash

# Create test job with holidays avoided
btr -t "09:00 tomorrow" \
    -r Days:1 \
    -a "Sat,Sun,Hday" \
    -T "Holiday test job" \
    /bin/true

# Check scheduled times around holidays
btjlist -v <job_number>

Should skip holidays and weekends.

Regional Holiday Calendars

Multiple locations:

If operating in multiple regions, maintain separate Xi-Batch instances with region-specific holidays.

Shared calendar:

If single Xi-Batch instance, include all regional holidays. Jobs will skip more days but ensures compliance everywhere.

Maintenance Job for Holiday Updates

Automate annual holiday updates:

bash

#!/bin/bash
# annual-holiday-update.sh
# Run once per year

YEAR=$(date +%Y)
NEXT_YEAR=$((YEAR + 1))

# Load next year's holidays
cat << EOF | xb-cholist
$NEXT_YEAR:1:1
$NEXT_YEAR:1:20
...
EOF

echo "Loaded holidays for $NEXT_YEAR"

# Send notification
echo "Holiday calendar updated for $NEXT_YEAR" | \
    mail -s "Xi-Batch Holidays Updated" admin@example.com

Schedule job to run annually:

bash

# Run December 1st each year
btr -t "09:00 2026-12-01" \
    -r Years:1 \
    /usr/local/sbin/annual-holiday-update.sh

Best Practices

Plan ahead:

Load holidays for upcoming year in December.

Backup calendar:

Export holidays before making changes:

bash

xb-cholist > holidays-backup-$(date +%Y%m%d).txt

Document holidays:

Keep list of holidays with reasons (federal, company, regional).

Test before deployment:

Verify holiday calendar with test jobs before relying on it.

Communicate changes:

Notify users when holidays added/removed from calendar.

Consider moving holidays:

Some holidays (like Thanksgiving) move each year - update accordingly.

Regional awareness:

Different countries/regions have different holidays - configure appropriately for your business.

Coordinate with HR:

Ensure Xi-Batch holiday calendar matches company calendar.

Controlling Job Flow with Conditions and Assignments
Creating dependencies and state changes using variables