#! /bin/sh # ipnd1_check TST="0000015" uldestshare="//S-VM-SQL14/tasdata" userid="vrt_svc_telmax" passwd="Z-dM-9o}s" uldestdir="IPND_Files" FSNfile="ipnd1.fseq" FILEerr_retry_cnt="001" #IPND_emailaddresslist="rod@transmit.com.au praveen.peiris@victrack.com.au jennifer.stevens@victrack.com.au robyn.douglas@victrack.com.au sam.musso@victrack.com.au Bharath.Bhooshan@VICTRACK.com.au" #IPND_emailaddresslist="rod@transmit.com.au praveen.peiris@victrack.com.au jennifer.stevens@victrack.com.au" IPND_emailaddresslist="rod@transmit.com.au" my_exit() { err="$1" msg1="$2" msg2="$3" attfiles="$4" echo $msg1 echo $msg2 # send check email if [ -n "$IPND_emailaddresslist" ]; then for emailaddress in $IPND_emailaddresslist do echo "$0: Sending IPND check email to emailaddress=[$emailaddress]" #---------------------------------------------------------- subject="IPND Check" EXTRAMSGTXT="" if [ -n "$attfilea" ]; then EXTRAMSGTXT="Please find attached" fi emcontent=`cat <&1 ${uldestshare} -U${userid}%${passwd} \ # -c "cd \"${uldestdir}\"; get \"${ipnderrfile}\"" #) # if [ ! -f "I_P_N_D.save/${ipnderrfile}" ]; then msg1="ERROR: ipnd1_check: did not get IPND err file" my_exit 1 "$msg1" "DID NOT GET .err FILE" "" fi ERRfile_lines=`wc -l "I_P_N_D.save/${ipnderrfile}" | cut -d " " -f 1` echo "ipnd1_check: ERRfile_lines=[$ERRfile_lines]" if [ $ERRfile_lines -gt 2 ]; then msg1="ERROR: ipnd1_check: there were ($ERRfile_lines) errors" # maybe exclude 43W here..... erranalysis=`awk ' { rectype = substr($0,1,3) if ( rectype == "HDR" || rectype == "TRL" ) # skip 1st and last next if ( NF < 3 ) { ++majorerr } errcode = $1 ++errcnt if ( errcode != "43W" ) { ++non43W } } END { if ( errcnt == 0 ) { print "no errors" } else { if ( majorerr ) print "MAJOR ERROR" if ( non43W) print "more than just 43W errors" else print "only 43W errors" } } ' < "I_P_N_D.save/${ipnderrfile}"` my_exit 1 "$msg1" "$erranalysis" "I_P_N_D.save/${ipnderrfile}" fi if [ $ERRfile_lines -ne 2 ]; then msg1="ipnd1_check: invalid line count ($ERRfile_lines)]" my_exit 1 "$msg1" "INVALID LINE COUNT" "I_P_N_D.save/${ipnderrfile}" fi # ipnd fetch and check err - ok msg1="ipnd1_check: NO errors" my_exit 0 "$msg1" "NO ERRORS" "I_P_N_D.save/${ipnderrfile}"