Skip to content

Commit 32d4c4f

Browse files
author
lutaoact
committed
sync_db_from_dd_test_server.sh
1 parent 03bbc86 commit 32d4c4f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sync_db_from_dd_test_server.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
suffix="$(date +'%Y%m%d%H%M%S')"
2+
echo "suffix is: $suffix"
3+
4+
backup_path="development_$suffix"
5+
echo "remote backup_path is: $backup_path"
6+
7+
backup_tar_gz="${backup_path}.tar.gz"
8+
echo "backup_tar_gz is: $backup_tar_gz"
9+
10+
remote_cmd="cd /root && mongodump -d development -o $backup_path && tar cvfz $backup_tar_gz $backup_path"
11+
echo "remote_cmd: $remote_cmd"
12+
13+
ssh dd "$remote_cmd"
14+
scp dd:"/root/$backup_tar_gz" "/data/backup"
15+
cd /data/backup
16+
tar xvfz $backup_tar_gz
17+
mongorestore --drop -d development "$backup_path/development/"

0 commit comments

Comments
 (0)