Add back the ability to have the period set by the cron to stay backwards compatible with anyone that was using a cron to specifically run only weekly, only monthly or any other specific backup.

This commit is contained in:
Chris Sewell
2012-12-03 06:45:31 -05:00
parent 900ff8ff3f
commit 97e9f125ba

View File

@ -19,12 +19,16 @@ TMP_PATH=~/
DATESTAMP=$(date +".%m.%d.%Y")
DAY=$(date +"%d")
DAYOFWEEK=$(date +"%A")
if [ ${DAY} = "01" ]; then
PERIOD=month
elif [ ${DAYOFWEEK} = "Sunday" ]; then
PERIOD=week
else
PERIOD=day
PERIOD=${1-day}
if [ ${PERIOD} = "auto" ]; then
if [ ${DAY} = "01" ]; then
PERIOD=month
elif [ ${DAYOFWEEK} = "Sunday" ]; then
PERIOD=week
else
PERIOD=day
fi
fi
echo "Selected period: $PERIOD."