I added some comments to the patch
On Fri, Jan 15, 2016 at 08:58:29AM +0200, Otto Kekäläinen wrote: > Thanks for reporting this and supplying a patch! > > Can you please make a new version where the scipt block has some > comments? There is rather complex stuff going on and somebody > reviewing it would have an easier time if they can from the comments > see what the code is supposed to do, and then read in the code that it > progresses correctly. Thanks!
diff --git b/etc/logrotate.d/mysql-server b/etc/logrotate.d/mysql-server index 01ab55e..0b2f1ad 100644 --- b/etc/logrotate.d/mysql-server +++ b/etc/logrotate.d/mysql-server @@ -16,9 +16,12 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then # Really no mysqld or rather a missing debian-sys-maint user? - # If this occurs and is not a error please report a bug. - if ps cax | grep -q mysqld; then - exit 1 + # Grab the PID file location from the mysql config + MRUN=$(grep -oP "^pid-file.*= \K[^$]+" /etc/mysql/my.cnf) + if [ -e $MRUN ]; then + MPID=$(cat $MRUN) + # Check if PID is running and compare the name of the running process + kill -0 $MPID && test $(ps -p $MPID -o comm=) = mysqld || exit 1 fi else $MYADMIN flush-logs