avoid commas in dump files
This commit is contained in:
parent
1c7e6b03e6
commit
dd60d883b7
2 changed files with 3 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
docker build -t eventman-dump-and-restore .
|
docker build -t eventman-dump-and-restore .
|
||||||
docker run --name eventman-restore --rm --network="eventman_default" -v `pwd`:/data --link=eventman_eventman-mongo_1:eventman-mongo eventman-dump-and-restore --restore $1
|
docker run --name eventman-restore --rm --network="eventman_default" -v `pwd`:/data --link=eventman_eventman-mongo_1:eventman-mongo eventman-dump-and-restore --restore "$1"
|
||||||
|
|
|
@ -13,14 +13,14 @@ elif [ "${cmd}" = "--dump" ] ; then
|
||||||
echo "INFO: dumping..."
|
echo "INFO: dumping..."
|
||||||
mongodump --host mongo --out /tmp/ --db eventman || (echo "ERROR: unable to dump the database" ; exit 10)
|
mongodump --host mongo --out /tmp/ --db eventman || (echo "ERROR: unable to dump the database" ; exit 10)
|
||||||
cd /tmp
|
cd /tmp
|
||||||
tar cfz /data/eventman-dump-`date +'%Y-%m-%dT%H:%M:%S'`.tgz eventman
|
tar cfz /data/eventman-dump-`date +'%Y-%m-%dT%H.%M.%S'`.tgz eventman --force-local
|
||||||
elif [ "${cmd}" = "--restore" ] ; then
|
elif [ "${cmd}" = "--restore" ] ; then
|
||||||
if [ -z "$2" ] ; then
|
if [ -z "$2" ] ; then
|
||||||
echo "ERROR: missing argument to --restore"
|
echo "ERROR: missing argument to --restore"
|
||||||
exit 20
|
exit 20
|
||||||
fi
|
fi
|
||||||
echo "INFO: restoring $2..."
|
echo "INFO: restoring $2..."
|
||||||
tar xfz "/data/$2" -C /tmp || (echo "ERROR: error unpacking file" ; exit 21)
|
tar xfz "/data/$2" -C /tmp --force-local || (echo "ERROR: error unpacking file" ; exit 21)
|
||||||
mongo --host mongo eventman --eval "db.dropDatabase()" || (echo "ERROR: error dropping the database" ; exit 22)
|
mongo --host mongo eventman --eval "db.dropDatabase()" || (echo "ERROR: error dropping the database" ; exit 22)
|
||||||
mongorestore --host mongo -d eventman /tmp/eventman
|
mongorestore --host mongo -d eventman /tmp/eventman
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue