[debian-mysql] Bug#810968: Bug#810968: Bug#810968: mariadb-server-10.0: Logrotate exists 1 if a non-debian mysqld is running (e.g. containerized mysqld)
Sergey Vojtovich
svoj at mariadb.org
Mon Mar 7 14:37:49 UTC 2016
Lennart,
On Mon, Mar 07, 2016 at 02:43:14PM +0100, Lennart Weller wrote:
...skip...
> 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[^$]+")
Good.
> + if [ -r $PID ]; then
> + test "$(ps -p $(cat $PID) -o comm=)" = "mysqld" && exit 1
Existence of pid-file is a sure sign that there's mysqld running, the only
exception is mysqld crash. What do you think about skipping this check?
I'd also suggest to turn things around and check for pid-file first and then
just run "MYADMIN flush-logs" allowing it to return error in case of failure.
If you like I can take your current patch and apply it upstream with some minor
corrections.
Regards,
Sergey
More information about the pkg-mysql-maint
mailing list