On Mon, Mar 07, 2016 at 04:15:54PM +0400, Sergey Vojtovich wrote: > > March 3 2016 9:35 PM, "Otto Kekäläinen" <o...@seravo.fi> wrote: > I consider it lesser evil. You may use my_print_defaults to get > pid-file value. > > Worth to note that I don't see any value in executing "mysqladmin ping".
I attached a version of the patch using my_print_defaults with its standard locations. Not specifying any configuration files in case they change with 10.1. And the ping removed in favor of checking the exit code of flush-logs. I did some rudimentary testing. But I can't be sure that I caught all possible versions of existing files/processes and names. So there might be some corner cases with incorrect exit codes. Lennart
diff --git a/mariadb-server-10.0.mysql-server.logrotate.orig b/mariadb-server-10.0.mysql-server.logrotate index 52f1292..9a2050a 100644 --- a/mariadb-server-10.0.mysql-server.logrotate.orig +++ b/mariadb-server-10.0.mysql-server.logrotate @@ -14,14 +14,13 @@ # If this fails, check debian.conf! MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" - if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then - # Really no mysqld or in incorrect authentication in /etc/mysql/debian.cnf user? - # If this occurs and is not a error please report a bug. - if ps cax | grep -q mysqld; then - exit 1 + if [ ! $($MYADMIN flush-logs 2>/dev/null) ]; then + # If the pid-file exists and the process is mysqld it should have flushed + PID=$(my_print_defaults mysqld | grep -oP "pid-file=\K[^$]+") + if [ -r $PID ]; then + test "$(ps -p $(cat $PID) -o comm=)" = "mysqld" && exit 1 + exit 0 fi - else - $MYADMIN flush-logs fi endscript }
signature.asc
Description: Digital signature