Minor bugfixes to main queue.
[carnet-upgrade.git] / usr / share / carnet-upgrade / files / etc / logrotate.d / mysql-server
1 #
2 # - This script rotates the normal query-log and the slow-log files. 
3 #   Binary-log rotation is configured in /etc/mysql/debian-log-rotate.conf
4 # - All files should be in one block so that only one flush-logs is neccessary.
5 # - The error log is obsolete, messages go to syslog now.
6 /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql.err /var/log/mysql/mysql.err /var/log/mysql/mysql-slow.log {
7         daily
8         rotate 7
9         missingok
10         create 640 mysql adm
11         compress
12         sharedscripts
13         postrotate
14                 test -x /usr/bin/mysqladmin || exit 0
15
16                 # If this fails, check debian.conf! 
17                 export HOME=/etc/mysql/my.cnf
18                 MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
19                 if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then
20                   # Really no mysqld or rather a missing debian-sys-maint user?
21                   # If this occurs and is not a error please report a bug.
22                   if ps cax | grep -q mysqld; then
23                     exit 1
24                   fi 
25                 else
26                   $MYADMIN flush-logs
27                 fi
28                 errlogs=`ls /var/log/mysql.err* /var/log/mysql/mysql.err* 2>/dev/null`
29                 if [ -n "$errlogs" ]; then 
30                   chown root:adm $errlogs
31                   chmod 640 $errlogs
32                 fi
33         endscript
34 }