mongodb 备份脚本
###############
备份脚本
#!/bin/bash basepath="/data/backup/dump$(date +%Y%m%d%H%M%S)" if [ ! -d "$basepath" ]; then mkdir -p "$basepath" fi /usr/local/mongo/bin/mongodump --port 27017 -u "user" -p "password" --gzip --authenticationDatabase "admin" -o $basepath find /data/backup/ -mtime +30 -name "dump*" -exec rm -rf {} \;