#!/bin/sh
start="20170831"
end="20180208"
while [[ ${start} -le ${end} ]];do
  echo ${start}

  sql="ALTER TABLE dwh.dm_install_list_v2 DROP IF EXISTS PARTITION (dt='${start}',business='adserver')"
  echo "${sql}"
  if [[ $? -ne 0 ]]; then
    exit 255
  fi
  start=`date -d "1 day ${start}" +%Y%m%d`    # 日期自增
done