Answer the question
In order to leave comments, you need to log in
Mongo backup of all databases, via bash script, where can I get it?
Maybe someone has a simple bash script lying around?
Answer the question
In order to leave comments, you need to log in
Offhand there is a good script: https://gist.github.com/infynyxx/403885
#!/bin/sh
DATE=`/bin/date "+%Y%m%d-%H.%M.%S"`
dest_dir="/var/lib/mongo_backup"
/bin/mkdir -p $dest_dir /mongo.$DATE
mongodump $dump_flags -o $dest_dir/mongo.$DATE
cd $dest_dir/mongo.$DATE && for i in `ls`; do tar czvf $i.tar.gz $i; done
cd $dest_dir/mongo.$DATE && for i in `ls -l | grep -E '^d'`; do rm -rf $i; done
echo "mongo.$DATE.tgz moved to backup-server."
find ${dect_dir} -type f -mtime +21 -exec rm {} \;
exit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question