mongodb 日志清理

#!/bin/bash
#Rotate the MongoDB logs to prevent a single logfile from consuming too much disk space.
#app=mongod
#mongodPath=/root/mongodb-linux-x86_64-rhel62-3.5./bin
backpath=/data/backup/ echo "rs.slaveOk();db.runCommand({logRotate:1});" >/tmp/logappend.js
chmod /tmp/logappend.js
/usr/local/mongo/bin/mongo --port -u "root" -p "MANAGER" --authenticationDatabase "admin" admin /tmp/logappend.js mv /data/mongodb/replset/mongod.log.* $backpath
find $backpath -mtime + -name "mongod.log.20*" -exec rm -rf {} \;
上一篇:Java中常见数据结构List之LinkedList


下一篇:nginx之健康检查