Package: mariadb-server-10.0
Version: 10.0.22-0+deb8u1
Severity: minor
Tags: patch

Dear Maintainer,

The current logrotate script only checks if there is a mysqld process running
which it can't connect to. If this is the case the postrotate script exists with
1 causing a mail to be send.

I attached a patch which would remedy this situation by checking if the running
mysqld process is actually the one we are working with in the logrotate.


-- System Information:
Debian Release: 8.2
  APT prefers stable
  APT policy: (1000, 'stable'), (800, 'testing'), (700, 'unstable'), (500, 
'stable-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to de_DE.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mariadb-server-10.0 depends on:
ii  adduser                   3.113+nmu3
ii  debconf [debconf-2.0]     1.5.56
ii  libaio1                   0.3.110-1
ii  libc6                     2.19-18+deb8u1
ii  libdbi-perl               1.631-3+b1
ii  libpam0g                  1.1.8-3.1
ii  libstdc++6                5.2.1-23
ii  lsb-base                  4.1+Debian13+nmu1
ii  mariadb-client-10.0       10.0.22-0+deb8u1
ii  mariadb-common            10.0.22-0+deb8u1
ii  mariadb-server-core-10.0  10.0.22-0+deb8u1
ii  passwd                    1:4.2-3
ii  perl                      5.20.2-3+deb8u1
ii  psmisc                    22.21-2
ii  zlib1g                    1:1.2.8.dfsg-2+b1

Versions of packages mariadb-server-10.0 recommends:
ii  libhtml-template-perl  2.95-1

Versions of packages mariadb-server-10.0 suggests:
ii  bsd-mailx [mailx]  8.1.2-0.20141216cvs-2
pn  mariadb-test       <none>
pn  tinyca             <none>

-- Configuration Files:
/etc/logrotate.d/mysql-server changed [not included]

-- debconf information excluded
diff --git a/etc/logrotate.d/mysql-server b/etc/logrotate.d/mysql-server
index 01ab55e..567c27b 100644
--- a/etc/logrotate.d/mysql-server
+++ b/etc/logrotate.d/mysql-server
@@ -17,8 +17,10 @@
 		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
+		  MRUN=$(grep -oP "pid-file.*= \K[^$]+" /etc/mysql/my.cnf)
+		  if [ -e $MRUN]; then
+		    MPID=$(cat $MRUN)
+		    kill -0 $MPID && test $(ps -p $MPID -o comm=) = mysqld || exit 1
 		  fi
 		else
 		  $MYADMIN flush-logs

Reply via email to