-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump.sh
More file actions
21 lines (15 loc) · 738 Bytes
/
dump.sh
File metadata and controls
21 lines (15 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
#The script will archive the database with naming convention "mongodump_YYYY_MM__DD"
#
#The script require a connection string as a parameter to access the database
#usr - username
#pass - password
#server - cluster server names (should be 3)
#database - database name
usr=$1
pass=$2
server="case-sequencing-db-shard-00-00.usoro.mongodb.net:27017,case-sequencing-db-shard-00-01.usoro.mongodb.net:27017,case-sequencing-db-shard-00-02.usoro.mongodb.net:27017"
database=case_sequencing_db
curr_date=$(date +"%Y_%m_%d")
#Sanity checks, check if MongoDB Database Tools were installed
mongodump --host $server --username $usr --password $pass --authenticationDatabase admin --ssl --archive="mongodump_$curr_date" --db $database