Skip to content

Commit

Permalink
add debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
joseneto committed Nov 30, 2015
1 parent 668fb2a commit c9bb8d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if [ "$ONE_SHOOT" == "true" ]; then
else
# scheduele backup window
touch /var/log/cron.log;
echo "$BACKUP_WINDOW /backup/functions.sh >> /var/log/cron.log 2>&1" >> job
crontab job
echo "$BACKUP_WINDOW /backup/functions.sh >> /var/log/cron.log 2>&1"\n >> job;
crontab job;
tail -f /var/log/cron.log;
exit $?
fi
16 changes: 13 additions & 3 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,29 @@
DATETIME=`date +"%Y-%m-%d_%H"`

if [ "$MYSQL_PORT" == "" ]; then
MYSQL_PORT="3306";
export MYSQL_PORT="3306";
fi

if [ "$FILENAME" == "" ]; then
FILENAME="default";
export FILENAME="default";
fi

if [ "$NO_PASSWORD" == "" ]; then
NO_PASSWORD="false";
export NO_PASSWORD="false";
fi

make_backup () {

if ["$DEBUG" == "true" ]; then
echo "######################################"
echo "MYSQL_HOST = $MYSQL_HOST"
echo "MYSQL_PORT = $MYSQL_PORT"
echo "DB_USER = $DB_USER"
echo "DB_PASSWORD = $DB_PASSWORD"
echo "DB_NAME = $DB_NAME"
echo "######################################"
fi

if [ "$NO_PASSWORD" == "true" ]; then

mysqldump -h $MYSQL_HOST -P $MYSQL_PORT -u $DB_USER $DB_NAME > $FILENAME-$DATETIME.sql;
Expand Down

0 comments on commit c9bb8d3

Please sign in to comment.