#!/bin/bash
[ "$2" == "" ] && exec echo "Usage: $0 <SET_DIRECTORY> <PREVIOUS_DAY>"

SET_DIRECTORY=$1
PREVIOUS_DAY=$2

DIR=$(date +%Y%m%d -d "-${PREVIOUS_DAY} day")
FILE_PATTERN=$(date +%Y-%m-%d -d "-${PREVIOUS_DAY} day")

rm -rf ${HOME}/live/${SET_DIRECTORY}/Log/${DIR}/*xz
$HOME/bin/log_rotate_cmd ${HOME}/live/${SET_DIRECTORY} ${HOME}/live/${SET_DIRECTORY}/Log/${DIR} ${FILE_PATTERN}
