#!/bin/ksh
###################################################
#
# Shell script: patron-update
#
# 1999, Michael Doran, doran@uta.edu
# University of Texas at Arlington Libraries
#
# Runs the Voyager Patron Update program (see
# Voyager Technical Manual, page 65) which
# takes a patron file generated and FTP'd over
# by AIS and updates the Voyager patron database.
#
# Saves one week's worth of patron SIF, audit,
# and error files.
#
# Runs via the "voyager" crontab.
#
###################################################
# Variables
sess_file=/tmp/ptrnupdt.$$ # Session file
mail_rcp=doran # Session file recipient
circ_rcp=cencirc # Audit file recipient
script_name=$0 # Script name
day=`date +%a` # Abbrev weekday name
vpath=/m1/voyager/xxxdb # Voyager file path
# Files
update_prog=${vpath}/sbin/Pptrnupdt
audit_file=${vpath}/rpt/patron.aud.${day}
error_file=${vpath}/rpt/patron.err.${day}
update_file=/export/home/aisftp/LBJ00024.D01
update_save=/export/home/aisftp/ptrn-updt.${day}
#Function to add comments to session file
add ()
{
/usr/bin/echo "$1" >> ${sess_file}
}
# Create session file
add "Script ${script_name}\n`date`"
# Clear out this day's audit and error files
# otherwise, Pptrnupdt will append to old
/usr/bin/echo "" > ${audit_file}
/usr/bin/echo "" > ${error_file}
# Do update
if [ -s ${update_file} ]
then
${update_prog} \
-p ${update_file} \
-m 2000 \
-e ${error_file} \
-a ${audit_file} \
-o I >> ${sess_file} 2>&1
/usr/bin/mv ${update_file} ${update_save} >> ${sess_file} 2>&1
else
add "Patron update not run: No file from AIS"
/usr/bin/mailx -s "ABORT: Patron Update" ${mail_rcp} < ${sess_file}
exit 1
fi
# Send email to Systems person and Cen Circ person
add "${script_name} complete\n`date`"
/usr/bin/mailx -s "Patron Update" ${mail_rcp} < ${sess_file}
/usr/bin/mailx -s "Patron Update" ${circ_rcp} < ${audit_file}
# and exit script
exit 0
|