Commit 8942824a authored by Sergey Vojtovich's avatar Sergey Vojtovich

Fixed false errors returned by logrotate script

Logrotate script assumed an error if mysqladmin failed to connect to server
and there's mysqld process exists. However there can be non-system instance of
mysqld running (e.g. in docker) making this assumption wrong.

Check pid file existance instead.
parent d7721fcf
...@@ -10,18 +10,11 @@ ...@@ -10,18 +10,11 @@
compress compress
sharedscripts sharedscripts
postrotate postrotate
test -x /usr/bin/mysqladmin || exit 0 test -x /usr/bin/mysqladmin || exit 0
# If this fails, check debian.conf! if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" # If this fails, check debian.conf!
if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs
# Really no mysqld or rather a missing debian-sys-maint user? fi
# If this occurs and is not a error please report a bug.
if ps cax | grep -q mysqld; then
exit 1
fi
else
$MYADMIN flush-logs
fi
endscript endscript
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment