MongoDB备份脚本
#!/bin/bash
DATE=`date "+%y-%m-%d"`
echo $DATE
BASEDIR=$(pwd)
echo $BASEDIR
BACKUP_DIR="$BASEDIR/$DATE"
if [ ! -d $BACKUP_DIR ]; then
mkdir $BACKUP_DIR
fi
cd $BACKUP_DIR
echo $(pwd)
# begin to backup
/server/mongodb/bin/mongodump -h 127.0.0.1:7020 -d dbname -o $BACKUP_DIR