#!/bin/csh
#
# Filename: man_report -- a shell script
#
# Author: Kevin FitzGerrell
# Comments to: kfitz@gci.net or fitzgerrell@yahoo.com
#
# Usage: This script should be located in the directory /usr/scripts, or
# the references to this directory should be changed in the script as
# appropriate. The secondary script "bypasses" must be present also.
# Run man_report, no parameters needed, from the command line
# or execute from a display screen, or schedule via crontab. A PSR
# configuration file will need to be created and saved as "shiftm"
# outputing to "shift_info" reporting Blocks "In manual" on all
# relevant Control processors, compounds and Blocks.
#
# Description: This script utilizes the process summary reporter (PSR)
# utility. It will be scheduled by crontab or run directly. It generates a
# list of blocks in manual using the PSR. This list is filtered
# by egrep and sed to remove unwanted information and control blocks
# that will commonly be in manual. Then it runs /usr/scripts/bypasses,
# a series of object manager calls to check the status of various
# system bypasses and reports those with a "TRUE" status. The final
# report is sent to the line printer via LP.
#
# Created files: "/usr/fox/psr/files/shift_info" will be created by the PSR,
# and "/usr/scripts/shiftm.rpt" will be created by this script.
#
#
# Run the PSR with configuration file "shiftm"
/usr/fox/psr/psrreprt shiftm
# Build report heading in /usr/scripts/shiftm.rpt
echo -n " SHIFT STATUS REPORT " > /usr/scripts/shiftm.rpt
date "+%A %D %T" >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo "------------------------------------------------------------------------------" >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo "The following is a list of blocks in MANUAL that are normally in AUTO. " >> /usr/scripts/shiftm.rpt
echo "These should be placed in AUTO or logged and reported" >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
# Filter out entries that would typically be in manual, switches, controllers, etc...
egrep -v '(:STATION|:TOTAL|:.Y_|:.IC_|:.YC_|:SW_)' /usr/fox/psr/files/shift_info | sed '1,2d; $d' >> /usr/scripts/shiftm.rpt
# Add more report text to /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo "------------------------------------------------------------------------------" >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
echo "The following is a list of equipment in BYPASS that is not normally bypassed." >> /usr/scripts/shiftm.rpt
echo "This equipment should be removed from BYPASS or logged and reported" >> /usr/scripts/shiftm.rpt
echo " " >> /usr/scripts/shiftm.rpt
# Run secondary script to check for bypassable interlock status
/usr/scripts/bypasses > /usr/scripts/bypass.tmp
# Filter out unneeded info (FALSE responses and extra info)
grep "TRUE" /usr/scripts/bypass.tmp | awk -F":" '{ print "BYPASSED - " $1 }' >> /usr/scripts/shiftm.rpt
# Send to line printer (edit for your specific line printer)
lp -d LP51 /usr/scripts/shiftm.rpt
               (
geocities.com/fitzgerrell)