Redirect mongodump stdout to stderr

In version 3.x, the output of mongodump is on stderr, but on 2.6.x
it writes information to stdout. This change doesn't break 3.x in
my tests but prevents extraneous junk in beginning of the tar file
when exporting in 2.6.x.

Updated test to match redirect in exec command.
This commit is contained in:
Jacob Williams
2015-12-03 15:53:09 -06:00
parent 3d30b6ca35
commit 179b4984a3
2 changed files with 2 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ case "$1" in
PASSWORD="$(cat "$SERVICE_ROOT/PASSWORD")"
[[ -n $SSH_TTY ]] && stty -opost
docker exec "$SERVICE_NAME" bash -c "DIR=\$(mktemp -d) && mongodump -d $SERVICE -o \"\$DIR\" -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\""
docker exec "$SERVICE_NAME" bash -c "DIR=\$(mktemp -d) && mongodump -d $SERVICE -o \"\$DIR\" -u \"$SERVICE\" -p \"$PASSWORD\" --authenticationDatabase \"$SERVICE\" 1>&2 && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\""
[[ -n $SSH_TTY ]] && stty opost
;;