Skip to content

Instantly share code, notes, and snippets.

@NegativeFeedback
Created February 9, 2017 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NegativeFeedback/8c6a3f8c8249b1081f3d71793521ef16 to your computer and use it in GitHub Desktop.
Save NegativeFeedback/8c6a3f8c8249b1081f3d71793521ef16 to your computer and use it in GitHub Desktop.
#!/bin/bash
now=$(date +'%Y-%m-%d_%H.%M.%S')
mkdir -p backups/$now
cd backups/$now
mongodump
cd ..
zip -r $now.zip $now
cd ../..
echo "\nBACKUP DONE."
echo "Backup is at directory backups/${now}."
echo "Backup is also archived to .zip file backups/${now}.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment