mirror of https://github.com/Icinga/icinga2.git
Re-add the 'su' directive to logrotate if supported
- try to detect a recent logrotate version which supports the 'su'
directive (added in 3.8.0, see
5be96cf182 (diff-e4eb329834da3d36278b1b7d943b3bc9R6)
)
- if logrotate can't be found, assume an old version is used
- allow the parameter to be forced by the user
fixes #9249
Signed-off-by: Gunnar Beutner <gunnar@beutner.name>
This commit is contained in:
parent
98eef33399
commit
45786e2b81
|
@ -87,6 +87,22 @@ if(WIN32)
|
||||||
add_definitions(/bigobj)
|
add_definitions(/bigobj)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED LOGROTATE_HAS_SU)
|
||||||
|
set(LOGROTATE_HAS_SU OFF)
|
||||||
|
execute_process(COMMAND "/usr/sbin/logrotate" ERROR_VARIABLE LOGROTATE_OUTPUT)
|
||||||
|
if(LOGROTATE_OUTPUT)
|
||||||
|
string(REGEX REPLACE "^logrotate ([0-9.]*).*" "\\1" LOGROTATE_VERSION
|
||||||
|
${LOGROTATE_OUTPUT})
|
||||||
|
message(STATUS "Found logrotate (found version \"${LOGROTATE_VERSION}\")")
|
||||||
|
if("${LOGROTATE_VERSION}" VERSION_GREATER "3.7.9")
|
||||||
|
set(LOGROTATE_HAS_SU ON)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(LOGROTATE_HAS_SU)
|
||||||
|
set(LOGROTATE_USE_SU "\n\tsu ${ICINGA2_USER} ${ICINGA2_GROUP}")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS thread system program_options regex REQUIRED)
|
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS thread system program_options regex REQUIRED)
|
||||||
|
|
||||||
link_directories(${Boost_LIBRARY_DIRS})
|
link_directories(${Boost_LIBRARY_DIRS})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/icinga2.log @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/debug.log {
|
@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/icinga2.log @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/debug.log {
|
||||||
daily
|
daily
|
||||||
rotate 7
|
rotate 7@LOGROTATE_USE_SU@
|
||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
missingok
|
missingok
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/error.log {
|
@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/icinga2/error.log {
|
||||||
daily
|
daily
|
||||||
rotate 90
|
rotate 90@LOGROTATE_USE_SU@
|
||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
missingok
|
missingok
|
||||||
|
|
Loading…
Reference in New Issue