From 900ff8ff3f9f59616ad5c2187d1834266bdeaf94 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Mon, 3 Dec 2012 06:34:01 -0500 Subject: [PATCH] Have the script determine the period, rather than the cron. --- mysqltos3.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mysqltos3.sh b/mysqltos3.sh index 425db4b..45a90a2 100644 --- a/mysqltos3.sh +++ b/mysqltos3.sh @@ -16,9 +16,16 @@ MYSQLDUMPPATH= #tmp path. TMP_PATH=~/ -PERIOD=${1-day} - 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 +fi echo "Selected period: $PERIOD."