Skip to content

Commit

Permalink
pr updated based on comments
Browse files Browse the repository at this point in the history
Signed-off-by: Anish Dhanka <[email protected]>
  • Loading branch information
Anishmourya committed Nov 17, 2020
1 parent 262d4b6 commit 057f403
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
* Avi Deitcher <https://github.com/deitch>
* Juan Baptiste <https://github.com/juanluisbaptiste>
* Luke Barton <https://github.com/lukebarton>

* Anish Dhanka <https://github.com/anishmourya>
15 changes: 7 additions & 8 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,18 @@ function do_dump() {
workdir=/tmp/backup.$$
rm -rf $workdir
mkdir -p $workdir
NICE_CMD=
# if we asked to do by schema, then we need to get a list of all of the databases, take each, and then tar and zip them
if [ -n "$DB_DUMP_BY_SCHEMA" -a "$DB_DUMP_BY_SCHEMA" = "true" ]; then
if [[ -z "$DB_NAMES" ]]; then
DB_NAMES=$(mysql -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS -N -e 'show databases')
[ $? -ne 0 ] && return 1
fi
for onedb in $DB_NAMES; do
if [[ $NICE ]]; then
nice -n19 ionice -c2 mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS --databases ${onedb} $MYSQLDUMP_OPTS > $workdir/${onedb}_${now}.sql
else
mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS --databases ${onedb} $MYSQLDUMP_OPTS > $workdir/${onedb}_${now}.sql
if [ "$NICE" = "true" ]; then
NICE_CMD="nice -n19 ionice -c2"
fi
$NICE_CMD mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS --databases ${onedb} $MYSQLDUMP_OPTS > $workdir/${onedb}_${now}.sql
[ $? -ne 0 ] && return 1
done
else
Expand All @@ -139,11 +139,10 @@ function do_dump() {
else
DB_LIST="-A"
fi
if [[ $NICE ]]; then
nice -n19 ionice -c2 mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS $DB_LIST $MYSQLDUMP_OPTS > $workdir/backup_${now}.sql
else
mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS $DB_LIST $MYSQLDUMP_OPTS > $workdir/backup_${now}.sql
if [ "$NICE" = "true" ]; then
NICE_CMD="nice -n19 ionice -c2"
fi
$NICE_CMD mysqldump -h $DB_SERVER -P $DB_PORT $DBUSER $DBPASS $DB_LIST $MYSQLDUMP_OPTS > $workdir/backup_${now}.sql
[ $? -ne 0 ] && return 1
fi
tar -C $workdir -cvf - . | $COMPRESS > ${TMPDIR}/${SOURCE}
Expand Down

0 comments on commit 057f403

Please sign in to comment.