Bug #21542 the script of "/etc/cron.daily/mysql-server does not work
Submitted: 9 Aug 2006 15:21 Modified: 14 Aug 2006 8:03
Reporter: Qi Lu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.22 OS:Linux (debian linux)
Assigned to: CPU Architecture:Any

[9 Aug 2006 15:21] Qi Lu
Description:
The daily cron job "/etc/cron.daily/mysql-server" is used to clean old binlogs every day based on the information of KEEP_BINARY_LOGS given by the file of "/etc/mysql/debian-log-rotate.conf". But it does not work. If you manually execute the script of "/etc/cron.daily/mysql-server", you will see the error massage: 

ERROR 1373 (HY000) at line 1: Target log not found in binlog index

The problem is when the script try to find the reference file name by using "show master logs", it also return the file size. so when to execute the line
   PURGE MASTER LOGS TO 'referencefile';"
we got the above error message.

How to repeat:
just run 
$/etc/cron.daily/mysql-server

if the number of old binlog files is more than KEEP_BINARY_LOGS, you will get the error message.

Suggested fix:
fix is easy. in the script of /etc/cron.daily/mysql-server, modify the line 49:

   filename=`tail -n $KEEP_BINARY_LOGS $tmp | head -n 1` 
to:
   filename=`tail -n $KEEP_BINARY_LOGS $tmp | head -n 1 | awk '{print $1}'`

to remove the column of size.
[11 Aug 2006 7:52] Sveta Smirnova
Thank you for the report.

Could you please indicate accurate version of package you use?
[11 Aug 2006 13:30] Qi Lu
The package is for debian and name is Mysql-Server-5.0. The version is 5.0.22-3.
[14 Aug 2006 8:03] Sveta Smirnova
>The package is for debian and name is Mysql-Server-5.0. The version is 5.0.22-3.
Did you load it from debian? So it is debian bug: our packages contain other cron job for log rotation. You can find it in support-files/mysql-log-rotate file.