Skip to content

xisl/Helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Xi-Batch Diagnostic Helpers - Quick Guide

A sourceable bash library providing read-only diagnostic functions for Xi-Batch system administration.

Installation

Copy xib-helpers.sh to a convenient location and source it.

source /path/to/xib-helpers.sh

To make it available on every login, add the source line to your .bashrc or .profile, or place the file in /etc/profile.d/.

There is no initialisation step. Once sourced, all xib- functions are immediately available provided Xi-Batch commands are on your PATH.

Quick start

source xib-helpers.sh
xib-env                       # check detected paths and settings
xib-list-all                  # list all jobs
xib-list-running              # what is running right now
xib-list-errors               # anything in error or abort state

Common tasks

Finding jobs

xib-list-by-time 07:30        # jobs scheduled at 07:30
xib-list-by-user admin        # jobs owned by a specific user
xib-list-by-queue live         # jobs in a specific queue
xib-list-by-pattern backup    # jobs matching a pattern
xib-list-repeat               # all repeating jobs

Inspecting a job

Functions accept either a job name or numeric job ID.

xib-info backup_daily         # detailed job information
xib-script backup_daily       # view the job script
xib-history backup_daily      # recent log entries for this job
xib-compare-times backup_daily # schedule vs actual run history

Translating between names and IDs

xib-name-to-id backup_daily   # returns the numeric job ID
xib-id-to-name 13741          # returns the job name

Reviewing logs

xib-log-today                 # all log entries for today
xib-log-errors                # recent errors and aborts
xib-log-errors 50             # last 50 error entries
xib-log-on 12/02/26           # entries for a specific date
xib-log-for-job backup_daily  # all log entries for one job

Checking for problems

xib-check-repeat              # flag suspicious repeat specifications
xib-find-command btjchange    # find scripts that modify jobs

Variables

xib-vars                      # list all Xi-Batch variables
xib-var LOGJOBS               # show a specific variable

Monitoring

xib-watch backup_daily        # live watch (refreshes every 5s)
xib-watch backup_daily 10     # refresh every 10 seconds

Using with sudo

Xi-Batch commands often require elevated privileges. There are several ways to use the helpers with sudo.

For a single command, use sudo -E bash -c to run in a new shell. The -E flag preserves any environment variable overrides you have set.

sudo -E bash -c 'source /path/to/xib-helpers.sh && xib-list-all'

For an interactive session where you need to run multiple commands:

sudo -E bash
source /path/to/xib-helpers.sh
xib-list-all
xib-list-errors

To run as a specific user such as the batch service account:

sudo -u batch -E bash -c 'source /path/to/xib-helpers.sh && xib-env'

If the library is installed in /etc/profile.d/, it will be sourced automatically for login shells:

sudo -E bash -l
xib-list-all

Environment variables

If automatic path detection does not find the right locations, set these before sourcing the library.

XIB_SPOOLDIR : Override the spool directory path. If not set, the library checks SPOOLDIR (which Xi-Batch itself uses), then /usr/spool/batch and /var/spool/batch.

XIB_LOGFILE : Override the job log file path. If not set, the library reads the LOGJOBS variable from Xi-Batch, then looks for common log file names in the spool directory.

export XIB_SPOOLDIR=/opt/batch/spool
export XIB_LOGFILE=/opt/batch/spool/joblog
source xib-helpers.sh

Run xib-env at any time to see what paths are currently in effect.

Redirecting output

All listing functions write to stdout and can be redirected or piped as normal.

xib-list-all > jobs_snapshot.txt
xib-list-repeat | grep Days
xib-log-errors 100 | awk -F'|' '{print $4, $5}'

Reference

Run xib-help for the full function listing.

About

Helper tools and scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages