Skip to content

Commit 92bfd41

Browse files
author
joseneto
committed
minor change
1 parent aead22f commit 92bfd41

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ container to backup your mysql database's to Microsoft Azure Storare.
2525
- _`$ONE_SHOOT`_ - If true the container make the backup and exit, else the container still running and schedule a job in crontab. default false
2626
a backup window.
2727
- _`$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.
28+
- _`$DEBUG`_ - If true will give you the value of all variables in terminal. default to false
29+
- _`$NO_PASSWORD`_ - Connect to Mysql-Host without password, default to false
30+
31+
2832

2933
# Example of running
3034

backup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ if [ "$ONE_SHOOT" == "true" ]; then
1212
exit 0
1313

1414
else
15+
1516
sed 's,{{MYSQL_HOST}},'"${MYSQL_HOST}"',g' -i /backup/functions.sh
1617
sed 's,{{MYSQL_PORT}},'"${MYSQL_PORT}"',g' -i /backup/functions.sh
1718
sed 's,{{DB_USER}},'"${DB_USER}"',g' -i /backup/functions.sh
1819
sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /backup/functions.sh
1920
sed 's,{{DB_NAME}},'"${DB_NAME}"',g' -i /backup/functions.sh
2021
sed 's,{{DEBUG}},'"${DEBUG}"',g' -i /backup/functions.sh
22+
sed 's,{{AZURE_STORAGE_ACCOUNT}},'"${AZURE_STORAGE_ACCOUNT}"',g' -i /backup/functions.sh
23+
sed 's,{{AZURE_STORAGE_ACCESS_KEY}},'"${AZURE_STORAGE_ACCESS_KEY}"',g' -i /backup/functions.sh
24+
sed 's,{{FILENAME}},'"${FILENAME}"',g' -i /backup/functions.sh
25+
sed 's,{{CONTAINER}},'"${CONTAINER}"',g' -i /backup/functions.sh
2126
touch /var/log/cron.log;
2227
echo "$BACKUP_WINDOW /backup/variable.sh & /backup/functions.sh >> /var/log/cron.log 2>&1" >> job;
2328
echo "" >> job

functions.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,27 @@ fi
1616

1717
make_backup () {
1818

19+
export FILENAME={{FILENAME}}
20+
export CONTAINER={{CONTAINER}}
1921
export MYSQL_HOST={{MYSQL_HOST}}
2022
export MYSQL_PORT={{MYSQL_PORT}}
2123
export DB_USER={{DB_USER}}
2224
export DB_PASSWORD={{DB_PASSWORD}}
2325
export DB_NAME={{DB_NAME}}
2426
export DEBUG={{DEBUG}}
27+
export AZURE_STORAGE_ACCOUNT={{AZURE_STORAGE_ACCOUNT}}
28+
export AZURE_STORAGE_ACCESS_KEY={{AZURE_STORAGE_ACCESS_KEY}}
2529

2630
if [ "$DEBUG" == "true" ]; then
2731
echo "######################################"
32+
echo "FILENAME = $FILENAME"
33+
echo "CONTAINER = $CONTAINER"
2834
echo "MYSQL_HOST = $MYSQL_HOST"
2935
echo "MYSQL_PORT = $MYSQL_PORT"
3036
echo "DB_USER = $DB_USER"
3137
echo "DB_PASSWORD = $DB_PASSWORD"
38+
echo "AZURE_STORAGE_ACCOUNT = $AZURE_STORAGE_ACCOUNT"
39+
echo "AZURE_STORAGE_ACCESS_KEY = $AZURE_STORAGE_ACCESS_KEY "
3240
echo "DB_NAME = $DB_NAME"
3341
echo "######################################"
3442
fi
@@ -57,7 +65,7 @@ make_backup () {
5765
exit 1
5866
fi
5967
# Remove file to save space
60-
rm -fR $FILENAME-$DATETIME.sql.gz
68+
rm -fR *.sql.gz
6169

6270
}
6371

variable.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)