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
...@@ -12,16 +12,9 @@ ...@@ -12,16 +12,9 @@
postrotate postrotate
test -x /usr/bin/mysqladmin || exit 0 test -x /usr/bin/mysqladmin || exit 0
if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then
# If this fails, check debian.conf! # If this fails, check debian.conf!
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs
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
fi
else
$MYADMIN flush-logs
fi 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