Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
joseneto committed Dec 2, 2015
1 parent aead22f commit 92bfd41
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ container to backup your mysql database's to Microsoft Azure Storare.
- _`$ONE_SHOOT`_ - If true the container make the backup and exit, else the container still running and schedule a job in crontab. default false
a backup window.
- _`$BACKUP_WINDOW`_ - What time should backup run. you should use crontab format, so see [documentation](http://www.freebsd.org/cgi/man.cgi?crontab(5). default value every day at 6 am.
- _`$DEBUG`_ - If true will give you the value of all variables in terminal. default to false
- _`$NO_PASSWORD`_ - Connect to Mysql-Host without password, default to false



# Example of running

Expand Down
5 changes: 5 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ if [ "$ONE_SHOOT" == "true" ]; then
exit 0

else

sed 's,{{MYSQL_HOST}},'"${MYSQL_HOST}"',g' -i /backup/functions.sh
sed 's,{{MYSQL_PORT}},'"${MYSQL_PORT}"',g' -i /backup/functions.sh
sed 's,{{DB_USER}},'"${DB_USER}"',g' -i /backup/functions.sh
sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /backup/functions.sh
sed 's,{{DB_NAME}},'"${DB_NAME}"',g' -i /backup/functions.sh
sed 's,{{DEBUG}},'"${DEBUG}"',g' -i /backup/functions.sh
sed 's,{{AZURE_STORAGE_ACCOUNT}},'"${AZURE_STORAGE_ACCOUNT}"',g' -i /backup/functions.sh
sed 's,{{AZURE_STORAGE_ACCESS_KEY}},'"${AZURE_STORAGE_ACCESS_KEY}"',g' -i /backup/functions.sh
sed 's,{{FILENAME}},'"${FILENAME}"',g' -i /backup/functions.sh
sed 's,{{CONTAINER}},'"${CONTAINER}"',g' -i /backup/functions.sh
touch /var/log/cron.log;
echo "$BACKUP_WINDOW /backup/variable.sh & /backup/functions.sh >> /var/log/cron.log 2>&1" >> job;
echo "" >> job
Expand Down
10 changes: 9 additions & 1 deletion functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,27 @@ fi

make_backup () {

export FILENAME={{FILENAME}}
export CONTAINER={{CONTAINER}}
export MYSQL_HOST={{MYSQL_HOST}}
export MYSQL_PORT={{MYSQL_PORT}}
export DB_USER={{DB_USER}}
export DB_PASSWORD={{DB_PASSWORD}}
export DB_NAME={{DB_NAME}}
export DEBUG={{DEBUG}}
export AZURE_STORAGE_ACCOUNT={{AZURE_STORAGE_ACCOUNT}}
export AZURE_STORAGE_ACCESS_KEY={{AZURE_STORAGE_ACCESS_KEY}}

if [ "$DEBUG" == "true" ]; then
echo "######################################"
echo "FILENAME = $FILENAME"
echo "CONTAINER = $CONTAINER"
echo "MYSQL_HOST = $MYSQL_HOST"
echo "MYSQL_PORT = $MYSQL_PORT"
echo "DB_USER = $DB_USER"
echo "DB_PASSWORD = $DB_PASSWORD"
echo "AZURE_STORAGE_ACCOUNT = $AZURE_STORAGE_ACCOUNT"
echo "AZURE_STORAGE_ACCESS_KEY = $AZURE_STORAGE_ACCESS_KEY "
echo "DB_NAME = $DB_NAME"
echo "######################################"
fi
Expand Down Expand Up @@ -57,7 +65,7 @@ make_backup () {
exit 1
fi
# Remove file to save space
rm -fR $FILENAME-$DATETIME.sql.gz
rm -fR *.sql.gz

}

Expand Down
7 changes: 0 additions & 7 deletions variable.sh

This file was deleted.

0 comments on commit 92bfd41

Please sign in to comment.