: !/bin/sh # usage: wb4a SDATE EDATE STIME ETIME SITEID SDATE=$1; EDATE=$2; STIME=$3; ETIME=$4 HDATE="$EDATE" ################################ # extract config and call data for later process by wb4 # generate verification report # generate export csv ########################################################### if [ -n "$5" ]; then SITEID=$5 else SITEID="ALL" fi if [ -n "$6" ]; then thisCENTRE="$6" else thisCENTRE="all" fi ################################ MMYYYY=`SDATEtoMMYYYY $SDATE` echo "MMYYYY = [$MMYYYY]" billperiod=`MMYYYYtobillperiod $MMYYYY _` echo "$MMYYYY - billperiod = [$billperiod]" #batchtag="${billperiod}_all_${thisCENTRE}" ##batchtag="all_${thisCENTRE}" batchtag="${thisCENTRE}" ##################################### # save output # rjs9 #if [ -z "$logdir" ]; then # logdir="topdat/${billperiod}/log"; export logdir # export logdir # mkdir -p $logdir # echo "WARNING: wb4a: logdir not set using [$logdir]" #fi #exec 2>&1 >wb4a_${thisCENTRE}_log.rtf exec 2>&1 >wb4a_${batchtag}_log.rtf echo "$0: SDATE=[$SDATE] EDATE=[$EDATE]" echo " HDATE=[$HDATE] thisCENTRE=[$thisCENTRE]" echo " MMYYYY = [$MMYYYY]" export SDATE EDATE HDATE thisCENTRE echo " billperiod = [$billperiod]" ################################### # create access/account code conf unl acccodeconffile="t21acccodeconf.unl" rm -f $acccodeconffile if [ ! -f "$acccodeconffile" ]; then echo "Creating access code conf file: $acccodeconffile" gett21acccodeconf "$acccodeconffile" else echo "Using existing access code conf file: $acccodeconffile" fi # create route trunk conf unl t21rtfile="t21rt.unl" rm -f $t21rtfile if [ ! -f "indata/${billperiod}/"`basename $t21rtfile` ]; then echo "Creating route trunk conf file: $t21rtfile" gett21rt "$t21rtfile" else echo "Using existing route trunk conf file: $t21rtfile" cp "indata/${billperiod}/"`basename $t21rtfile` $t21rtfile fi # create mobile conf unl mobconffile="mobconf.unl" rm -f $mobconffile if [ ! -f "indata/${billperiod}/"`basename $mobconffile` ]; then echo "Creating mobile conf file: $mobconffile" ##getmobconf "$mobconffile" #getSIDMAINTconf "$mobconffile" "" "mobile_phones" $SDATE $EDATE # get mobconf info from tbs data gettbsmobconf "$mobconffile" else echo "Using existing mobile conf file: $mobconffile" cp "indata/${billperiod}/"`basename $mobconffile` $mobconffile fi # create chargecat unl chargecatfile="chargecat.unl" rm -f $chargecatfile if [ ! -f "indata/${billperiod}/"`basename $chargecatfile` ]; then echo "Creating chargecat file: $chargecatfile" getchargecat "$chargecatfile" else echo "Using existing chargecat file: $chargecatfile" cp "indata/${billperiod}/"`basename $chargecatfile` $chargecatfile fi # create dataplan unl dataplanfile="dataplan.unl" rm -f $dataplanfile if [ ! -f "indata/${billperiod}/"`basename $dataplanfile` ]; then echo "Creating dataplan file: $dataplanfile" getdataplan "$dataplanfile" else echo "Using existing dataplan file: $dataplanfile" cp "indata/${billperiod}/"`basename $dataplanfile` $dataplanfile fi # create T21 extranges unl t21extrangesfile="t21extranges.unl" rm -f $t21extrangesfile if [ ! -f "indata/${billperiod}/"`basename $t21extrangesfile` ]; then echo "Creating T21 extranges file: $t21extrangesfile" gett21extranges "$t21extrangesfile" else echo "Using existing T21 extranges file: $t21extrangesfile" cp "indata/${billperiod}/"`basename $t21extrangesfile` $t21extrangesfile fi # create t21groups4.unl t21groups4file="t21groups4.unl" rm -f $t21groups4file if [ ! -f "indata/${billperiod}/"`basename $t21groups4file` ]; then echo "Creating T21 groups4 file: $t21groups4file" gett21groups4 $t21groups4file else echo "Using existing T21 groups4 file: $t21groups4file" cp "indata/${billperiod}/"`basename $t21groups4file` $t21groups4file fi # get T21 Directory Enquiry csv t21dircsvfile="T21E.csv" rm -f $t21dircsvfile if [ ! -f "indata/${billperiod}/"`basename $t21dircsvfile` ]; then echo "Creating T21 dircsv file: $t21dircsvfile" # extract directory csv #T21E_getcsv "$t21dircsvfile" #T21Eghistdcsv "$t21dircsvfile" T21Eptc_getcsv "$t21dircsvfile" else echo "Using existing T21 dircsv file: $t21dircsvfile" cp "indata/${billperiod}/"`basename $t21dircsvfile` $t21dircsvfile fi # remove previous directory csv image file and copy new rm -f img/direnq/$t21dircsvfile cp $t21dircsvfile img/direnq # create t21WBDL.unl (Web Billing Distribution lists) t21WBDLfile="t21WBDL.unl" rm -f $t21WBDLfile if [ ! -f "indata/${billperiod}/"`basename $t21WBDLfile` ]; then echo "Creating T21 WBDL file: $t21WBDLfile" gett21WBDL "$SDATE" "$EDATE" STIME ETIME "$SITEID" "$t21WBDLfile" else echo "Using existing T21 WBDL file: $t21WBDLfile" cp "indata/${billperiod}/"`basename $t21WBDLfile` $t21WBDLfile fi # create t21wbdexclude.unl (Web Billing Dist exclude site/grid/extn lists) t21wbdexcludefile="t21wbdexclude.unl" rm -f $t21wbdexcludefile if [ ! -f "indata/${billperiod}/"`basename $t21wbdexcludefile` ]; then echo "Creating T21 Web Billing Dist Exclusion file file: $t21wbdexcludefile" gett21wbdexclude "$t21wbdexcludefile" else echo "Using existing T21 WBDL file: $t21wbdexcludefile" cp "indata/${billperiod}/"`basename $t21wbdexcludefile` $t21wbdexcludefile fi ######################################################## # for Back Billing savedir="indata/${billperiod}/TELMAX21" edd=`echo $EDATE | sed -e 's/\/..\/....$//g'` emm=`echo $EDATE | sed -e 's/^..\///g;s/\/....$//g'` eyyyy=`echo $EDATE | sed -e 's/^..\/..\///g'` eyyyymmdd="${eyyyy}${emm}${edd}" if [ "$retroBDL" != "1" ]; then # init bb1 files bb1file="TIMS_${eyyyy}${emm}${edd}.txt" invfile="TIMS_${eyyyy}${emm}${edd}_invoice.csv" othfile="TIMS_${eyyyy}${emm}${edd}.other" # remove any remnants and create empty files before starting # (wb4.awk will append to these files) > "$bb1file" > "$invfile" > "$othfile" fi ######################################################## # make indata folders #if [ ! -d "indata/${billperiod}" ]; then mkdir -p "indata/${billperiod}" mkdir -p "indata/${billperiod}/TELMAX21" mkdir -p "indata/${billperiod}/TELMAX21/PP" mkdir -p "indata/${billperiod}/TELSTRABRSS" mkdir -p "indata/${billperiod}/TELSTRA" mkdir -p "indata/${billperiod}/OPTUS" mkdir -p "indata/${billperiod}/VODAFONE" mkdir -p "indata/${billperiod}/AAPT" mkdir -p "indata/${billperiod}/REST" chmod 777 "indata/${billperiod}" chmod 777 "indata/${billperiod}/TELMAX21" chmod 777 "indata/${billperiod}/TELMAX21/PP" chmod 777 "indata/${billperiod}/TELSTRABRSS" chmod 777 "indata/${billperiod}/TELSTRA" chmod 777 "indata/${billperiod}/OPTUS" chmod 777 "indata/${billperiod}/VODAFONE" chmod 777 "indata/${billperiod}/AAPT" chmod 777 "indata/${billperiod}/REST" #fi # fix perms find indata/${billperiod} -depth -exec chgrp catcom {} \; find indata/${billperiod} -depth -exec chown catcom {} \; # create VICTRACK sym link ( cd "indata/${billperiod}"; ln -s "TELMAX21" "VICTRACK" ) ######################################################## # save input data files if [ ! -f "indata/${billperiod}/"`basename $acccodeconffile` ]; then cp $acccodeconffile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21rtfile` ]; then cp $t21rtfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $mobconffile` ]; then cp $mobconffile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $chargecatfile` ]; then cp $chargecatfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $dataplanfile` ]; then cp $dataplanfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21extrangesfile` ]; then cp $t21extrangesfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21groups4file` ]; then cp $t21groups4file "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21dircsvfile` ]; then cp $t21dircsvfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21WBDLfile` ]; then cp $t21WBDLfile "indata/${billperiod}" fi if [ ! -f "indata/${billperiod}/"`basename $t21wbdexcludefile` ]; then cp $t21wbdexcludefile "indata/${billperiod}" fi ### save other input files ##if [ ! -f "indata/${billperiod}/"`basename $tblTASSEMapfile` ]; then ## cp $tblTASSEMapfile "indata/${billperiod}" ##fi #if [ ! -f "indata/${billperiod}/seidtranslate.csv" ]; then # cp "indata/seidtranslate.csv" "indata/${billperiod}" #fi ######################################################## # create t21 account code calls file t21acccodecallsfile="indata/${billperiod}/TELMAX21/cda_${MMYYYY}.in" if [ ! -f "$t21acccodecallsfile" ]; then echo "Creating T21 account code calls file: $t21acccodecallsfile" #gett21cda1 "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" 2>&1 | tee gett21cda.log cp /dev/null cda1.in # save acccode calls file mv cda1.in $t21acccodecallsfile else echo "Using existing T21 account code calls file: $t21acccodecallsfile" fi ######################################################## # create t21 overheads files t21ovhfile="indata/${billperiod}/TELMAX21/ovh_${MMYYYY}.in" if [ ! -f "$t21ovhfile" ]; then echo "Creating T21 overheads file: $t21ovhfile" #time ovh13 "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" 2>&1 | tee ovh13.log #time gett21ovh "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" 2>&1 | tee gett21ovh.log cp /dev/null ovh.in # save overheads file mv ovh.in $t21ovhfile else echo "Using existing T21 overheads file: $t21ovhfile" fi ######################################################## # create t21 calls file t21callsfile="indata/${billperiod}/TELMAX21/c9_${MMYYYY}.in" if [ ! -f "$t21callsfile" ]; then echo "Creating T21 calls file: $t21callsfile" time cdr9 "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" 2>&1 | tee cdr9.log #gett21cdr1 "$SDATE" "$EDATE" "Nulls" "Nulls" "$SITEID" 2>&1 | tee gett21cdr.log # save calls file mv c9.in $t21callsfile grep VAC $t21callsfile >${t21callsfile}.VAC #mv cdr1.in $t21callsfile else echo "Using existing T21 calls file: $t21callsfile" fi ######################################################## # create t21 SWITCHBOARD calls file t21swcallsfile="indata/${billperiod}/VICTRACK/s9_${MMYYYY}.in" if [ ! -f "$t21swcallsfile" ]; then echo "Creating T21 SWITCHBOARD calls file: $t21swcallsfile" time swb9 "$SDATE" "$EDATE" "Nulls" "Nulls" "ALL" 2>&1 | tee swb9.log # save file mv s9.in $t21swcallsfile else echo "Using existing T21 SWITCHBOARD calls file: $t21swcallsfile" fi ######################################################## # create t21 VOICEMAIL calls file t21vmcallsfile="indata/${billperiod}/VICTRACK/v9_${MMYYYY}.in" if [ ! -f "$t21vmcallsfile" ]; then echo "Creating T21 VOICEMAIL calls file: $t21vmcallsfile" time vml9 "$SDATE" "$EDATE" "Nulls" "Nulls" "ALL" 2>&1 | tee vml9.log # save file mv v9.in $t21vmcallsfile else echo "Using existing T21 VOICEMAIL calls file: $t21vmcallsfile" fi ######################################################## # create t21 rent (tec) file t21tecfile="indata/${billperiod}/VICTRACK/r9_${MMYYYY}.in" if [ ! -f "$t21tecfile" ]; then echo "Creating T21 TEC (rent) file: $t21tecfile" time tec9 "$SDATE" "$EDATE" "Nulls" "Nulls" "ALL" 2>&1 | tee tec9.log # save file mv r9.in $t21tecfile grep VAC >${t21tecfile}.VAC else echo "Using existing T21 TEC (rent) file: $t21tecfile" fi ################################## ################################## # make preprossesor input files ppcallsfile="indata/${billperiod}/VICTRACK/PP/c9_${MMYYYY}.txt" sed -e 's/$/ /' <"$t21callsfile" >"$ppcallsfile" ppswcallsfile="indata/${billperiod}/VICTRACK/PP/s9_${MMYYYY}.txt" sed -e 's/$/ /' <"$t21swcallsfile" >"$ppswcallsfile" ppvmcallsfile="indata/${billperiod}/VICTRACK/PP/v9_${MMYYYY}.txt" sed -e 's/$/ /' <"$t21vmcallsfile" >"$ppvmcallsfile" pptecfile="indata/${billperiod}/VICTRACK/PP/r9_${MMYYYY}.txt" sed -e 's/$/ /' <"$t21tecfile" >"$pptecfile" ########################### ## Testing ## create t21 calls file for single thisCENTRE #if [ "$thisCENTRE" != "all" ]; then # singlet21callsfile="indata/${billperiod}/TELMAX21/c9_${thisCENTRE}_${MMYYYY}.in" # if [ ! -f "$singlet21callsfile" ]; then # echo "Creating single T21 calls file: $singlet21callsfile for $thisCENTRE" # grep -F "${thisCENTRE}," $t21callsfile >$singlet21callsfile # else # echo "Using existing single T21 calls file: $singlet21callsfile" # fi # t21callsfile=$singlet21callsfile #fi ############################### ## create mobile calls file #mobcallsfile="indata/${billperiod}/TELMAX21/wb4_m11_${MMYYYY}.in" ## always redo #rm -f "$mobcallsfile" #if [ ! -f "$mobcallsfile" ]; then # echo "Creating mobile calls file: $mobcallsfile" # domob $SDATE $EDATE wb4_m11.in # mv wb4_m11.in "$mobcallsfile" #else # echo "Using existing mobile calls file: $mobcallsfile" #fi ################################### # get exwebconf - should always get new copy incase of changes exwebconffile="exwebconfr.csv" runisql <&1 unload to /tmp/$exwebconffile delimiter "," select * from exwebconf order by parent; SQLCMD0 cp /tmp/$exwebconffile $exwebconffile ## save to indata cp $exwebconffile "indata/${billperiod}" ######################################################## # generate verification report and csv and back billing #gawk --dump-variable awk -f wb4.awk -v "MMYYYY=$MMYYYY" -v"sdate=$SDATE" -v"edate=$EDATE" \ -v "logdir=$logdir" \ -v "dot21verify=1" \ -v "retroBDL=0" \ -v "thisCENTRE=$thisCENTRE" \ -v "t21acccodecallsfile=$t21acccodecallsfile" \ -v "t21ovhfile=$t21ovhfile" \ -v "t21callsfile=$t21callsfile" \ -v "t21swcallsfile=$t21swcallsfile" \ -v "t21vmcallsfile=$t21vmcallsfile" \ -v "t21tecfile=$t21tecfile" \ -v "mobcallsfile=$mobcallsfile" \ -v "acccodeconffile=$acccodeconffile" \ -v "mobconffile=$mobconffile" \ -v "exwebconffile=$exwebconffile" \ -v "chargecatfile=$chargecatfile" \ -v "t21rtfile=$t21rtfile" \ -v "t21extrangesfile=$t21extrangesfile" \ -v "t21groups4file=$t21groups4file" \ -v "t21dircsvfile=$t21dircsvfile" \ -v "t21WBDLfile=$t21WBDLfile" \ -v "t21wbdexcludefile=$t21wbdexcludefile" # rename HIERIDx file HIERIDxrtffile="HIERIDx_${batchtag}_lsta.rtf" mv HIERIDx_${batchtag}.lst "$HIERIDxrtffile" ##################### # get warnings errwarnlogfile="ex4a_ERROR_WARNING_${batchtag}.rtf" rm -f $errwarnlogfile echo "" >>$errwarnlogfile echo "Warning / Error LOG" >>$errwarnlogfile echo "------------------------------------------" >>$errwarnlogfile echo "" >>$errwarnlogfile head -3 wb4a_${batchtag}_log.rtf >>$errwarnlogfile echo "" >>$errwarnlogfile egrep "FATAL|WARNING|ERROR" wb4a_${batchtag}_log.rtf | sort -u >>$errwarnlogfile echo "" >>$errwarnlogfile if [ -s wb4a_${batchtag}.out ]; then cat wb4a_${batchtag}.out >>$errwarnlogfile echo "" >>$errwarnlogfile fi # zip log files ex4zip="ex4a_${batchtag}_LOGS.zip" rm -f "ex4zip" zip -9 "$ex4zip" \ $errwarnlogfile \ wb4a_${batchtag}_log.rtf # $HIERIDxrtffile ################################################################## ## email wb4a validation reports / export csv emailex4tot ex4a_ $batchtag #emailex3tot "ex3a" "$billperiod" all "all" "" " ######################################################### # complete back billing #completebb1 $eyyyymmdd "$savedir" "$batchtag" ######################################################### # achive logs #logdir="topdat/${billperiod}/log" logdir="logs/$billperiod" rm -rf "$logdir" mkdir -p "$logdir" ls HIERIDx_${batchtag}_lst.rtf \ ex4a_totrep_${thisCENTRE}.txt \ ex4a_totcsv_${thisCENTRE}_mobiles.csv \ ex4a_totcsv_${thisCENTRE}.csv \ ex4a_ERROR_WARNING_${batchtag}.rtf \ $ex4zip \ exwebconf.csv \ wb4a_${batchtag}_log.rtf \ wb4a_${batchtag}.out \ nohup.out \ | cpio -pvdum "$logdir" #-------- exit 0