sourcePath='/var/mash5/mongodb-linux-x86_64-1.8.1/bin'
targetPath='/var/mash5/mongodb-linux-x86_64-1.8.1/bak'
rm -rf $sourcePath/dump
$sourcePath/mongodump --port 27017 -d mash5_t2 -o $sourcePath/dump
cp -r $sourcePath/dump $targetPath/dump+`date +%Y%m%d%H%M%S`
转载于:http://blog.youkuaiyun.com/lu467344991/article/details/7646011