mirror of
https://github.com/ChrisSewell/MySQL-backup-to-Amazon-S3.git
synced 2025-07-01 18:47:26 -04:00
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:
16
mysqltos3.sh
16
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."
|
||||
|
Reference in New Issue
Block a user