MXS-2445 Add logrotate config file

This commit is contained in:
Esa Korhonen 2019-06-03 16:56:51 +03:00
parent 1ba77b59e2
commit 57029bb1a1
5 changed files with 25 additions and 0 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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
}

View File

@ -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 {} \;

View File

@ -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