1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-23 09:12:14 +01:00

Install fastnetmon.service with cmake

The path to the fastnetmon daemon might differ, thus use configure_file
to set the path dynamically.
This commit is contained in:
Benjamin Drung 2017-05-29 16:50:23 +02:00
parent 28fbaa5d1a
commit f397d61593
2 changed files with 8 additions and 1 deletions

@ -27,6 +27,9 @@ project(FastNetMon)
set (FASTNETMON_VERSION_MAJOR 1)
set (FASTNETMON_VERSION_MINOR 1)
set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "/lib/systemd/system"
CACHE PATH "Location for systemd service files")
if (ENABLE_GOBGP_SUPPORT)
# We could not compile gRPC without C++ 11
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
@ -600,6 +603,10 @@ install(FILES networks_whitelist DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
install(FILES man/fastnetmon.1 DESTINATION /usr/share/man/man1)
install(FILES man/fastnetmon_client.1 DESTINATION /usr/share/man/man1)
# service files
configure_file(fastnetmon.service.in "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/fastnetmon.service" DESTINATION ${CMAKE_INSTALL_SYSTEMD_SERVICEDIR})
# Configure cpack package builder
# Run it with: cd build; cpack -G DEB ..
set(CPACK_PACKAGE_NAME "fastnetmon")

@ -4,7 +4,7 @@ After=syslog.target network.target remote-fs.target
[Service]
Type=forking
ExecStart=/opt/fastnetmon/fastnetmon --daemonize
ExecStart=@CMAKE_INSTALL_SBINDIR@/fastnetmon --daemonize
PIDFile=/run/fastnetmon.pid
Restart=on-failure
RestartSec=3