Created
March 14, 2016 07:37
-
-
Save seidler2547/7c3cbeb99bab0a80d011 to your computer and use it in GitHub Desktop.
Cron entry to keep the MySQL log space at 90%
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
*/5 * * * * /bin/df /var/log/mysql -P | /bin/awk '/^\/dev/ { exit 100.0*$4/$2 < 10 }' || /usr/bin/mysql -u monitor -e "purge binary logs to '$(cd /var/log/mysql ; ls -1tr mysql-bin.[0-9]* | head -2 | tail -1)'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment