: !/bin/sh carrier="$1" sidmainttype="$2" infile="$3" infileext="$4" SDATE="$5" EDATE="$6" uploadlog="$7" tmplogfile="/tmp/dodatasrctmplog$$.txt" rm -f "$tmplogfile" ( #------------------------------------------------------------------------- echo "dodatasrc: Started..." echo " carrier=[$carrier]" echo " sidmainttype=[$sidmainttype]" echo " infile=[$infile]" echo " infileext=[$infileext]" echo " SDATE=[$SDATE]" echo " EDATE=[$EDATE]" echo " uploadlog=$uploadlog]" ######################################################## # get current month for bill period if SDATE not passed if [ "$SDATE" = "" ]; then echo "getting rptdates for tm (this month)" eval `rptdates tm sfd | awk '{printf("SDATE=\"%s\"; EDATE=\"%s\"", $1, $2)}'` echo " SDATE=[$SDATE] EDATE=[$EDATE]" fi ######################################################## #MMYYYY="MMYYYY" MMYYYY=`SDATEtoMMYYYY $SDATE` echo "MMYYYY = [$MMYYYY]" #billeriod="MMM_YYYY" billperiod=`MMYYYYtobillperiod $MMYYYY _` echo "$MMYYYY - billperiod = [$billperiod]" #------------------------------------------- datasrcid=`basename $infile ".${infileext}" | cut -c1-5` tagname=`basename "$infile"` echo "" echo "dodatasrc: datasrcid=[$datasrcid]" echo "dodatasrc: tagname=$tagname" #--------------------------------------------------- INFOLDER="indata/${billperiod}/${carrier}/${sidmainttype}" echo "" echo "dodatasrc: INFOLDER=[$INFOLDER]" if [ ! -d "$INFOLDER/out" ]; then mkdir -p "$INFOLDER/out" chmod 777 "$INFOLDER" chmod 777 "$INFOLDER/out" fi verifyreportfile="${INFOLDER}/out/verify_report_${tagname}.html" baseverifyreportfile=`basename "$verifyreportfile"` #dodatasrclogfile="dodatasrc.log" dodatasrclogfile="${INFOLDER}/out/${tagname}.log" basedodatasrclogfile=`basename "$dodatasrclogfile"` echo "" echo "dodatasrc: verifyreportfile=$verifyreportfile" echo "dodatasrc: baseverifyreportfile=$baseverifyreportfile" echo "dodatasrc: dodatasrclogfile=$dodatasrclogfile" echo "dodatasrc: basedodatasrclogfile=$basedodatasrclogfile" rm -f "$verifyreportfile" rm -f "$dodatasrclogfile" #------------------------------------------- stddetailfile="$INFOLDER/out/${datasrcid}_${carrier}_${sidmainttype}_${MMYYYY}.out" echo "" echo "dodatasrc: stddetailfile=[$stddetailfile]" # remove old stddetailfile rm -f "$stddetailfile" # convert supplied data file to standard format ( echo "------------------------------------" cd "$INFOLDER" echo " pwd="`pwd` exrel="../../../.." echo " exrel=$exrel" # create stddetailfile echo "Run: \"${exrel}/do${carrier}_${sidmainttype}\" \"$MMYYYY\" \"${exrel}/${INFOLDER}/$infile\" \"${exrel}/$stddetailfile\" \"$datasrcid\"" time "${exrel}/do${carrier}_${sidmainttype}" "$MMYYYY" "${exrel}/${INFOLDER}/$infile" "${exrel}/$stddetailfile" "$datasrcid" ) #cp $stddetailfile /tmp/1 ######################################################## # verify data echo "------------------------------------" echo "Run: verifydatasrc \"$carrier\" \"$sidmainttype\" \"$stddetailfile\" \"$billperiod\" \"$SDATE\" \"$EDATE\" \"$datasrcid\" | tee -a \"$dodatasrclogfile\"" time verifydatasrc "$carrier" "$sidmainttype" "$stddetailfile" "$billperiod" "$SDATE" "$EDATE" "$datasrcid" # save log in indata out cp "$tmplogfile" "$dodatasrclogfile" # so bilmax21 user can replace (when run from file upload) chmod 666 "$stddetailfile" chmod 666 "$verifyreportfile" chmod 666 "$dodatasrclogfile" ########################################################################## # send email attf="$verifyreportfile" subject="Verify Import Data File $carrier $tagname Report" #emailaddr="$emailaddr rod@transmit.com.au" #emailaddr="rod@transmit.com.au" #emailaddr="catcom rod@transmit.com.au" #emailaddr="catcom" emailaddr="$WBUPFILEADMINEMAIL" #emailaddr="$WBUPFILEADMINEMAIL rod@transmit.com.au" emailaddr="support@transmit.com.au" echo "Sending $subject email to: $emailaddr" zip -r -9 "${tmplogfile}.zip" "$tmplogfile" # Force mail to pass DATE as GMT TZ=''; export TZ ( #( #echo "Content-type: text/html;" #echo " charset=\"us-ascii\"" #echo "Content-Transfer-Encoding: quoted-printable" #echo "" #echo "" #echo "" #echo "$subject" #echo "" #echo "" echo "Please Find Attached Report and Log Information for the Verification of" #echo "
" echo "Import Data file: $tagname ($carrier)" #echo "
" #cat $attf #echo "" #echo "" #) | mimencode uuencode $attf "$baseverifyreportfile" if [ -n "$uploadlog" ]; then uuencode "$uploadlog" "upload_$basedodatasrclogfile" fi uuencode "${tmplogfile}.zip" "${basedodatasrclogfile}.zip" ) | mail -s "$subject" $emailaddr #------------------------------------------------------------------------- ) 2>&1 | tee -a "$tmplogfile" rm -f "${tmplogfile}.zip" rm -f "$tmplogfile" exit 0