logrotate mysqld errors Topic is solved
logrotate mysqld errors
I'm on Ubuntu 18.04, and I keep getting an email everynight saying logrotate failed due to:
/etc/cron.daily/logrotate: logrotate_script: 3: [: /var/run/mysqld/mysqld.pid: unexpected operator
I can't track this down... some help please?
/etc/cron.daily/logrotate: logrotate_script: 3: [: /var/run/mysqld/mysqld.pid: unexpected operator
I can't track this down... some help please?
Re: logrotate mysqld errors
For further information I can run
logrotate /etc/logrotate.conf --debug
And there is no error. I can am unable to find this.
Hope for help. :-)
logrotate /etc/logrotate.conf --debug
And there is no error. I can am unable to find this.
Hope for help. :-)
Re: logrotate mysqld errors
For anyone else having this problem, I have to add it was MariaDB... not mysql 5.7
I figured it out.
In /etc/logrotate.d/mysql-server there was the line:
Which produces two matches, causing the error. Simple fix is m1 attribute added to grep:
Now all runs perfectly :-)
I figured it out.
In /etc/logrotate.d/mysql-server there was the line:
Code: Select all
my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"
Code: Select all
my_print_defaults --mysqld | grep -oPm1 "pid-file=\K[^$]+"