Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/bash
# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

# Get standard environment variables
PRGDIR=`dirname $(readlink -f "$PRG")`
PYTHON_DIR="/usr/local/lib/python2.6/dist-packages/PyProj-0.1-py2.6.egg"
DATE=`date +%Y-%b-%d`

#Email the two report files.

FROM='cnc.center@shop2020.in'
PASSWD='5h0p2o2o'

mysql -uroot -pshop2020 -h 192.168.190.114 inventory -e "update currentinventorysnapshot c, warehouse w set availability = 0 where w.id = c.warehouse_id and isAvailabilityMonitored = 0 and vendor_id = 1 and availability < 0"

mysql -uroot -pshop2020 -h 192.168.190.114 inventory -e "select w.displayName, c.item_id, c.availability, c.reserved from currentinventorysnapshot c, warehouse w where w.id = c.warehouse_id and isAvailabilityMonitored = 0 and vendor_id = 1 and availability > 0" > /tmp/NegativeInventory.${DATE}.tsv

python ${PYTHON_DIR}/shop2020/utils/EmailAttachmentSender.py -f ${FROM} -p ${PASSWD} -t sandeep.sachdeva@shop2020.in -t khushal.bhatia@shop2020.in -t rajveer.singh@shop2020.in -s "Additional Inventory in Hotspot warehouses" -a /tmp/NegativeInventory.${DATE}.tsv

rm /tmp/NegativeInventory.${DATE}.tsv