How do I check if a database exists in bash?
I’m planning to make an automated backup script, where each website’s db name is:
(siteName) mysite.com = mysite_com (dbName)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can check if a file exists with the -e bash command. MongoDB creates a Namespace file for each database, so search for those. Something like
Assuming your data is stored in /data/db
Have a look at the mongodump command which can be used to backup data from your mongo db instance
http://www.mongodb.org/display/DOCS/Backups