Created
July 3, 2013 19:45
-
-
Save RamaRoberts/5922093 to your computer and use it in GitHub Desktop.
Log rotation for MongoDB.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOGSDIR="/app/mongodb/logs" | |
# this causes mongo to rotate logs | |
killall -SIGUSR1 mongod | |
# now purge the older logs | |
logs=`find ${LOGSDIR}/ -type f -mtime +30` | |
for log in $logs; do | |
rm $log | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment