/logrotate.d/mysql-server

http://github.com/brinkman83/bashrc · #! · 27 lines · 27 code · 0 blank · 0 comment · 0 complexity · 0444ac882cb54e558e4346b0526b0ec1 MD5 · raw file

  1. # - I put everything in one block and added sharedscripts, so that mysql gets
  2. # flush-logs'd only once.
  3. # Else the binary logs would automatically increase by n times every day.
  4. # - The error log is obsolete, messages go to syslog now.
  5. /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log {
  6. daily
  7. rotate 7
  8. missingok
  9. create 640 mysql adm
  10. compress
  11. sharedscripts
  12. postrotate
  13. test -x /usr/bin/mysqladmin || exit 0
  14. # If this fails, check debian.conf!
  15. MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
  16. if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then
  17. # Really no mysqld or rather a missing debian-sys-maint user?
  18. # If this occurs and is not a error please report a bug.
  19. #if ps cax | grep -q mysqld; then
  20. if killall -q -s0 -umysql mysqld; then
  21. exit 1
  22. fi
  23. else
  24. $MYADMIN flush-logs
  25. fi
  26. endscript
  27. }