: !/bin/sh ######################################################################## # T21BATCHNAME rtfreq.t21batch # T21BATCHDESC Route Dialled Number Frequency Report # ALLOWBLANKDATES false # CUSTOMDESC # CUSTOMDEF # T21BATCHVAR1DESC # T21BATCHVAR1VALU # T21BATCHVAR2DESC # T21BATCHVAR2VALU # T21BATCHVAR3DESC # T21BATCHVAR3VALU # T21BATCHVAR4DESC # T21BATCHVAR4VALU # T21BATCHVAR5DESC # T21BATCHVAR5VALU # T21BATCHENDARGS ######################################################################## # command line args SDATE=$1; EDATE=$2; STIME=$3; ETIME=$4 SITEID=$5 CMDPARAM=$6 ################################################################# lastdayinmonth() # Returns the last day in month, Inputs: $1=mm $2=yyyy { cal $1 $2 | awk '{ if ( NF > 0 ) x=$NF } END { print x }' } ################################################################# # MAIN ################################################################# if [ -z "$SITEID" ]; then echo "Enter siteid (Enter for ALL):\c"; read SITEID fi if [ -z "$SITEID" ]; then SITEID="ALL" fi if [ -z "$SDATE" ]; then echo "Enter start date:\c"; read SDATE fi if [ -z "$EDATE" ]; then echo "Enter end date:\c"; read EDATE fi #if [ -z "$STIME" ]; then # echo "Enter start time:\c"; read STIME #fi #if [ -z "$ETIME" ]; then # echo "Enter end time:\c"; read ETIME #fi if [ "$SITEID" = "ALL" ]; then SITEID="Nulls" SITEBIT="" else SITEBIT="and siteid = $SITEID" fi ########################################################################### # Testing #SDATE="01/06/2004" #EDATE="30/06/2004" ########################################################################### TMPRTAG="rtfreq" tmpfile=/tmp/${TMPRTAG}_$$ tmpfile1=/tmp/${TMPRTAG}_1_$$ rm -f $tmpfile rm -f $tmpfile1 ########################################################################### ########################################################################### # send script output to file exec >$tmpfile 2>&1 ########################################################################### #echo "Starting $0: $SDATE $EDATE - " `date` ######################################################################### ########################################################################### # prepare for report output setting to be controlled within this script # disable rpt options set if spooled if [ "$spoolt21rptopts" -eq 1 ]; then spoolt21rptopts=0 export spoolt21rptopts runont21_pid=$rptque_pid fi # make sure runont21_pid is set for srct21rptopts script to find temp rpt opts if [ -z "$runont21_pid" ]; then runont21_pid="$$" fi export runont21_pid # must be set so pr_rep sets uue_pid dobatch_pid=$runont21_pid; export dobatch_pid # set pr_rep env file name for concat/email ALL-IN-ONE if [ -z "$pr_rep_env_file" ]; then pr_rep_env_file="$HOME/pr_rep.env$runont21_pid" export pr_rep_env_file fi ############################################################ ############################################################ # run report ( sdd=`echo $SDATE | sed -e 's/\/..\/....$//g'` smm=`echo $SDATE | sed -e 's/^..\///g;s/\/....$//g'` syyyy=`echo $SDATE | sed -e 's/^..\/..\///g'` edd=`echo $EDATE | sed -e 's/\/..\/....$//g'` emm=`echo $EDATE | sed -e 's/^..\///g;s/\/....$//g'` eyyyy=`echo $EDATE | sed -e 's/^..\/..\///g'` dd=$sdd; mm=$smm; yyyy=$syyyy while true do dodate="$dd/$mm/$yyyy" tbldate=`echo $dodate | sed -e 's/\//_/g'` cdrtable="c$tbldate" #echo "dodate=$dodate cdrtable=$cdrtable dd=$dd mm=$mm yyyy=$yyyy" #echo #echo " For $dodate" runisql 2>&1 <