March 3 2016 9:35 PM, "Otto Kekäläinen" <o...@seravo.fi> wrote:
> Hello Lennart!
> 
> I asked core developers to review this and got this reply:
> 
> It's probably alright for 10.0. But it's not completely suitable for 10.1.
> As contributor mentioned himself that there's a problem with this patch:
> "When mysqld is called without mysqld_safe".
> 
> I'd rather simplify this script to something like (not tested):
> if [ -x /var/run/mysqld/mysqld.pid ]; then
> $MYADMIN flush-logs || exit 1
> fi
> 
> What do you think?

The line would result in some other issues. But the general idea was already 
tossed around
here before. Assume pid file location and then check if the process running on 
the pid
is named mysqld.

I don't really see an issue with my current version either though. In case that 
the mysqld_safe script
will be abandoned in the future a lot of the configuration files and init 
scripts/unit files
need to be updated anyhow. And the only change here would be removing one layer 
in the hierachy.

From:
PPID=$(ps -o ppid= -p $PID)
if [ $(ps -p $PPID -o comm=) = mysqld_safe ]; then
  test $(ps -o ppid= -p  $PPID) -eq 1 && exit 1
fi

To:
test $(ps -o ppid= -p $PID) -eq 1 && exit 1

But if you are fine with just checking the PID file at a static location 
something like the attached patch should be fine.

Attachment: logrotate.patch
Description: Binary data

Reply via email to