#!/bin/bash
#########################################################################
# Runs once a day to copy the order_db.txt file to a daily file
# and reset the order_db.txt file.
#########################################################################
ODBPATH=/homev/infinexm/public_html/cgi-bin/ifxmall/Admin_files
ODBNAME=order
ODBTYPE=db
ODBCUR=$ODBPATH/$ODBNAME.$ODBTYPE
ZDATE=`date +%Y-%m-%d`
ODBSAV=$ODBPATH/orders/$ODBNAME-$ZDATE.$ODBTYPE
cp -a $ODBCUR $ODBSAV
>$ODBCUR
ZODBSIZ=`wc -l $ODBSAV`
ZODBSIZ=`echo $ZODBSIZ | cut -d" " -f1`
if test $ZODBSIZ -ne 0
then
  ZODBSIZ=`expr $ZODBSIZ - 1`
fi
echo "Total orders on $ZDATE was $ZODBSIZ." | /usr/sbin/sendmail georgema@infinex.com,ackong@infinex.com,jimlum@infinex.com 
