#!/bin/bash 

renice +20 -p $$ >/dev/null 2>&1

#DEBUG=1

# dates to del, seq command does not work?
DAYS=30

. /etc/env.global

# expecting to already set
#MEDPATH=${MEDIAPATH%%[:|,]*}
#SCH_DIR=${MEDPATH}/.. ???
SCH_DIR=/var/sch
VER_DIR=/var/local/lib/dpi/ver 


for a in `seq ${DAYS}`; do 
   month=`date --date "${a} day ago" +%-m` 
   day=`date --date "${a} day ago" +%d` 
   hex_month=`printf "%X" ${month}`
   if [ $DEBUG ] ; then
      echo ${SCH_DIR}/${hex_month}${day}?????.SCH 
      echo ${VER_DIR}/${hex_month}${day}?????.SCH 
   else
      rm ${SCH_DIR}/${hex_month}${day}?????.SCH 2>&1
      rm ${VER_DIR}/${hex_month}${day}?????.SCH 2>&1
   fi
done 


