Skip to content

Commit

Permalink
add backup/restore script
Browse files Browse the repository at this point in the history
  • Loading branch information
skadefro committed Jul 19, 2022
1 parent ab92921 commit 34d3334
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions db-backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
docker-compose exec mongodb rm /tmp/openflow.bak
docker-compose exec mongodb /usr/bin/mongodump --db openflow --gzip --archive=/tmp/openflow.bak
docker compose cp mongodb:/tmp/openflow.bak .
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
echo "Current Time : $current_time"
cp openflow.bak openflow.$current_time.bak
3 changes: 3 additions & 0 deletions db-restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
docker compose cp openflow.bak mongodb:/tmp/
docker-compose exec mongodb /usr/bin/mongorestore --gzip --archive=/tmp/openflow.bak

0 comments on commit 34d3334

Please sign in to comment.