A sourceable bash library providing read-only diagnostic functions for Xi-Batch system administration.
Copy xib-helpers.sh to a convenient location and source it.
source /path/to/xib-helpers.shTo 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.
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 statexib-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 jobsFunctions 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 historyxib-name-to-id backup_daily # returns the numeric job ID
xib-id-to-name 13741 # returns the job namexib-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 jobxib-check-repeat # flag suspicious repeat specifications
xib-find-command btjchange # find scripts that modify jobsxib-vars # list all Xi-Batch variables
xib-var LOGJOBS # show a specific variablexib-watch backup_daily # live watch (refreshes every 5s)
xib-watch backup_daily 10 # refresh every 10 secondsXi-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-errorsTo 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-allIf 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.shRun xib-env at any time to see what paths are currently in effect.
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}'Run xib-help for the full function listing.