From 97e9f125ba74b89d40a289e643e7b1899baa0999 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Mon, 3 Dec 2012 06:45:31 -0500 Subject: [PATCH] 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. --- mysqltos3.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mysqltos3.sh b/mysqltos3.sh index 45a90a2..a8a9e6d 100644 --- a/mysqltos3.sh +++ b/mysqltos3.sh @@ -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."