From 1ba77b59e265e999aa3b0a59a21d0894d58996f6 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Thu, 6 Jun 2019 17:07:32 +0300 Subject: [PATCH 1/2] MXS-2548 Show correct monitor state in "maxadmin list monitors" The code OR:d with 0. --- server/core/monitor.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/core/monitor.cc b/server/core/monitor.cc index 7cd38130d..1d2fb6828 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -606,11 +606,8 @@ void monitor_list(DCB* dcb) { if (ptr->active) { - dcb_printf(dcb, - "%-20s | %s\n", - ptr->name, - ptr->state & MONITOR_STATE_RUNNING ? - "Running" : "Stopped"); + dcb_printf(dcb, "%-20s | %s\n", + ptr->name, ptr->state == MONITOR_STATE_RUNNING ? "Running" : "Stopped"); } ptr = ptr->next; } From 57029bb1a1ec3194b07113bbe8649949155d41d4 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Mon, 3 Jun 2019 16:56:51 +0300 Subject: [PATCH 2/2] MXS-2445 Add logrotate config file --- CMakeLists.txt | 1 + cmake/init_scripts.cmake | 2 ++ etc/logrotate.d/maxscale_logrotate | 11 +++++++++++ etc/postinst.in | 6 ++++++ etc/postrm.in | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 etc/logrotate.d/maxscale_logrotate diff --git a/CMakeLists.txt b/CMakeLists.txt index 3017ba4df..a4288ece3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,6 +233,7 @@ install_file(${CMAKE_SOURCE_DIR}/LICENSE-THIRDPARTY.TXT core) install_file(etc/lsyncd_example.conf core) install_manual(Documentation/maxscale.1 1 core) install_file(${CMAKE_SOURCE_DIR}/server/maxscale_binlogserver_template.cnf core) +install_file(${CMAKE_SOURCE_DIR}/etc/logrotate.d/maxscale_logrotate core) # For devel package, these files are put to the base folder install_header(${CMAKE_SOURCE_DIR}/COPYRIGHT devel) diff --git a/cmake/init_scripts.cmake b/cmake/init_scripts.cmake index 1ab095eba..01f526e1a 100644 --- a/cmake/init_scripts.cmake +++ b/cmake/init_scripts.cmake @@ -50,8 +50,10 @@ else() install(FILES ${CMAKE_BINARY_DIR}/maxscale.conf DESTINATION /etc/ld.so.conf.d COMPONENT core) install(FILES ${CMAKE_BINARY_DIR}/maxscale.service DESTINATION /usr/lib/systemd/system COMPONENT core) install(FILES ${CMAKE_BINARY_DIR}/upstart/maxscale.conf DESTINATION /etc/init/) + install(FILES ${CMAKE_SOURCE_DIR}/etc/logrotate.d/maxscale_logrotate DESTINATION /etc/logrotate.d/) message(STATUS "Installing maxscale.conf to: /etc/ld.so.conf.d") message(STATUS "Installing startup scripts to: /etc/init.d") message(STATUS "Installing systemd service files to: /usr/lib/systemd/system") message(STATUS "Installing upstart files to: /etc/init/") + message(STATUS "Installing logrotate config to: /etc/logrotate.d/maxscale_logrotate") endif() diff --git a/etc/logrotate.d/maxscale_logrotate b/etc/logrotate.d/maxscale_logrotate new file mode 100644 index 000000000..360b9006d --- /dev/null +++ b/etc/logrotate.d/maxscale_logrotate @@ -0,0 +1,11 @@ +/var/log/maxscale/maxscale.log { +monthly +rotate 5 +missingok +nocompress +sharedscripts +postrotate +kill -USR1 `cat /var/run/maxscale/maxscale.pid` +endscript +} + diff --git a/etc/postinst.in b/etc/postinst.in index 592fcf0ce..17ab823d3 100755 --- a/etc/postinst.in +++ b/etc/postinst.in @@ -73,6 +73,12 @@ then cp @MAXSCALE_CONFDIR@/maxscale.cnf.template @MAXSCALE_CONFDIR@/maxscale.cnf fi +# If no logrotate config file is found, create one +if [ ! -f "etc/logrotate.d/maxscale_logrotate" ] +then + cp @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/maxscale_logrotate /etc/logrotate.d/maxscale_logrotate +fi + # This will allow us to install the Perl scripts as executable files # without adding the Perl dependencies find @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/plugins/nagios -name '*.pl' -exec chmod ug+x {} \; diff --git a/etc/postrm.in b/etc/postrm.in index 4a10dcaf3..1e31d788f 100755 --- a/etc/postrm.in +++ b/etc/postrm.in @@ -22,4 +22,9 @@ then then rm /lib/systemd/system/maxscale.service fi + + if [ -f /etc/logrotate.d/maxscale_logrotate ] + then + rm /etc/logrotate.d/maxscale_logrotate + fi fi