Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
RESTORE_UTILITY='/opt/mongodb/bin/mongorestore'
DB_NAME='my_db'
log() {
echo $1
}
do_restore(){
local fname=$1
tar -jxf $1 && \
${RESTORE_UTILITY} -d ${DB_NAME} ${fname//.bz2}/${DB_NAME}
}
get_file_from_s3(){
python aws_s3.py get $1
}
do_cleanup(){
rm -rf db_backup_2010*
log 'cleaning up....'
}
if [ $# -lt 1 ]
then
echo "Usage: $0 <backup_filename>"
exit 1
fi
filename=$1
get_file_from_s3 ${filename} && do_restore ${filename} && do_cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.