From 85f564f2b4c580bc151d05559e6ed0614919da8a Mon Sep 17 00:00:00 2001 From: Christian Muck Date: Mon, 4 Jun 2012 09:08:52 +0200 Subject: [GDLT-90] Implemented systemd watchdog concept in dlt-system Signed-off-by: Christian Muck --- systemd/CMakeLists.txt | 40 +++++++++++++++++++++++++--------- systemd/dlt-adaptor-udp.service.cmake | 28 ++++++++++++++++++++++++ systemd/dlt-example-user.service.cmake | 25 +++++++++++++++++++++ systemd/dlt-receive.service.cmake | 26 ++++++++++++++++++++++ systemd/dlt-syslog.service.cmake | 25 --------------------- systemd/dlt-system.service.cmake | 31 ++++++++++++++++++++++++++ systemd/dlt.service.cmake | 10 ++++----- 7 files changed, 144 insertions(+), 41 deletions(-) create mode 100644 systemd/dlt-adaptor-udp.service.cmake create mode 100644 systemd/dlt-example-user.service.cmake create mode 100644 systemd/dlt-receive.service.cmake delete mode 100755 systemd/dlt-syslog.service.cmake create mode 100755 systemd/dlt-system.service.cmake (limited to 'systemd') diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt index 7411364..d01c1ef 100644 --- a/systemd/CMakeLists.txt +++ b/systemd/CMakeLists.txt @@ -15,26 +15,46 @@ ######## if(WITH_SYSTEMD) + set(SYSTEMD_CONFIGURATIONS_FILES_DIR "/lib/systemd/system" ) if(WITH_SYSTEMD_WATCHDOG) set( DLT_WatchdogSec 2 ) - message( STATUS "The systemd watchdog is enabled for DLT daemon - timeout is set to ${DLT_WatchdogSec} seconds") + message( STATUS "The systemd watchdog is enabled - timeout is set to ${DLT_WatchdogSec} seconds") else(WITH_SYSTEMD_WATCHDOG) set( DLT_WatchdogSec 0 ) - message( STATUS "The systemd watchdog is disabled for DLT daemon") + message( STATUS "The systemd watchdog is disabled") endif(WITH_SYSTEMD_WATCHDOG) configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt.service) - install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) message( STATUS "Configured systemd unit file:dlt.service" ) - set( DLT_SYSLOG_APPID "SYS" ) - set( DLT_SYSLOG_CTID "LOG" ) - set( DLT_SYSLOG_PORT 4712 ) - message(STATUS "DLT-syslog configuration: APPID:${DLT_SYSLOG_APPID} CTID:${DLT_SYSLOG_CTID} PORT:${DLT_SYSLOG_PORT}" ) - configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt-syslog.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt-syslog.service) - install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-syslog.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) - message( STATUS "Configured systemd unit file:dlt-syslog.service" ) + configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt-system.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt-system.service) + message( STATUS "Configured systemd unit file:dlt-system.service" ) + + configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt-receive.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt-receive.service) + message( STATUS "Configured systemd unit file:dlt-receive.service" ) + + configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt-example-user.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt-example-user.service) + message( STATUS "Configured systemd unit file:dlt-example-user.service" ) + + set( DLT_ADAPTOR_UDP_APPID "DUDP" ) + set( DLT_ADAPTOR_UDP_CTID "DCTI" ) + set( DLT_ADAPTOR_UDP_PORT 4712 ) + configure_file(${CMAKE_SOURCE_DIR}/systemd/dlt-adaptor-udp.service.cmake ${PROJECT_BINARY_DIR}/systemd/dlt-adaptor-udp.service) + message( STATUS "Configured systemd unit file:dlt-adaptor-udp.service" ) + message(STATUS "DLT adaptor udp configuration: APPID=${DLT_ADAPTOR_UDP_APPID} CTID=${DLT_ADAPTOR_UDP_CTID} PORT=${DLT_ADAPTOR_UDP_PORT}" ) + + if(EXISTS ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-system.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-receive.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-example-user.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + install(FILES ${PROJECT_BINARY_DIR}/systemd/dlt-adaptor-udp.service DESTINATION ${SYSTEMD_CONFIGURATIONS_FILES_DIR} ) + message(STATUS "Unit files will be installed to ${SYSTEMD_CONFIGURATIONS_FILES_DIR} after make install" ) + else(EXISTS ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) + message(STATUS "Unit files will not be installed to ${SYSTEMD_CONFIGURATIONS_FILES_DIR} after make install") + endif(EXISTS ${SYSTEMD_CONFIGURATIONS_FILES_DIR}) + endif(WITH_SYSTEMD) \ No newline at end of file diff --git a/systemd/dlt-adaptor-udp.service.cmake b/systemd/dlt-adaptor-udp.service.cmake new file mode 100644 index 0000000..0c39637 --- /dev/null +++ b/systemd/dlt-adaptor-udp.service.cmake @@ -0,0 +1,28 @@ +####### +# Dlt - Diagnostic Log and Trace +# @licence make begin@ +# +# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel +# +# Contributions are licensed to the GENIVI Alliance under one or more +# Contribution License Agreements. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with +# this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# @licence end@ +######## + +[Unit] +Description=GENIVI DLT adaptor stdin. Adaptor for forwarding received UDP messages to DLT daemon. +Wants=dlt.service + +[Service] +Type=Simple +User=genivi +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-adaptor-udp -a @DLT_ADAPTOR_UDP_APPID@ -c @DLT_ADAPTOR_UDP_CTID@ -p @DLT_ADAPTOR_UDP_PORT@ +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/systemd/dlt-example-user.service.cmake b/systemd/dlt-example-user.service.cmake new file mode 100644 index 0000000..3652292 --- /dev/null +++ b/systemd/dlt-example-user.service.cmake @@ -0,0 +1,25 @@ +####### +# Dlt - Diagnostic Log and Trace +# @licence make begin@ +# +# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel +# +# Contributions are licensed to the GENIVI Alliance under one or more +# Contribution License Agreements. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with +# this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# @licence end@ +######## + +[Unit] +Description=GENIVI DLT example user. Generate DLT messages and store them to file or send them to daemon. +Wants=dlt.service + +[Service] +Type=Simple +User=genivi +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-example-user "Hallo from GENIVI DLT example user application" +LimitCORE=infinity \ No newline at end of file diff --git a/systemd/dlt-receive.service.cmake b/systemd/dlt-receive.service.cmake new file mode 100644 index 0000000..b92c8b2 --- /dev/null +++ b/systemd/dlt-receive.service.cmake @@ -0,0 +1,26 @@ +####### +# Dlt - Diagnostic Log and Trace +# @licence make begin@ +# +# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel +# +# Contributions are licensed to the GENIVI Alliance under one or more +# Contribution License Agreements. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with +# this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# @licence end@ +######## + +[Unit] +Description=GENIVI DLT receive. Receive DLT messages from DLT daemon and print or store the messages. +Documentation=man:dlt-receive(1) +Wants=dlt.service + +[Service] +Type=Simple +User=genivi +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-receive -o /tmp/dlt_receive_log.dlt localhost +LimitCORE=infinity \ No newline at end of file diff --git a/systemd/dlt-syslog.service.cmake b/systemd/dlt-syslog.service.cmake deleted file mode 100755 index a962841..0000000 --- a/systemd/dlt-syslog.service.cmake +++ /dev/null @@ -1,25 +0,0 @@ -####### -# Dlt - Diagnostic Log and Trace -# @licence make begin@ -# -# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel -# -# Contributions are licensed to the GENIVI Alliance under one or more -# Contribution License Agreements. -# -# This Source Code Form is subject to the terms of the -# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with -# this file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# @licence end@ -######## - -[Unit] -Description=DLT Syslog Adapter - -[Service] -ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-adaptor-udp -a @DLT_SYSLOG_APPID@ -c @DLT_SYSLOG_CTID@ -p @DLT_SYSLOG_PORT@ -# Restart=always - -[Install] -WantedBy=basic.target diff --git a/systemd/dlt-system.service.cmake b/systemd/dlt-system.service.cmake new file mode 100755 index 0000000..fc30f74 --- /dev/null +++ b/systemd/dlt-system.service.cmake @@ -0,0 +1,31 @@ +####### +# Dlt - Diagnostic Log and Trace +# @licence make begin@ +# +# Copyright (C) 2011-2012, BMW AG - Alexander Wenzel +# +# Contributions are licensed to the GENIVI Alliance under one or more +# Contribution License Agreements. +# +# This Source Code Form is subject to the terms of the +# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with +# this file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# @licence end@ +######## + +[Unit] +Description=GENIVI DLT system. Application to forward syslog messages to DLT, transfer system information, logs and files. +Documentation=man:dlt-system(1) man:dlt-system.conf(5) +Wants=dlt.service + +[Service] +Type=Simple +User=genivi +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-system +WatchdogSec=@DLT_WatchdogSec@ +NotifyAccess=main +LimitCORE=infinity + +[Install] +WantedBy=basic.target \ No newline at end of file diff --git a/systemd/dlt.service.cmake b/systemd/dlt.service.cmake index 43cb319..22279c4 100755 --- a/systemd/dlt.service.cmake +++ b/systemd/dlt.service.cmake @@ -15,18 +15,16 @@ ######## [Unit] -Description=GENIVI DLT -Documentation=dlt-daemon(1) dlt.conf(5) +Description=GENIVI DLT logging daemon +Documentation=man:dlt-daemon(1) man:dlt.conf(5) [Service] Type=Simple User=genivi -#ExecStartPre=rm /tmp/dlt ExecStart=@CMAKE_INSTALL_PREFIX@/bin/dlt-daemon WatchdogSec=@DLT_WatchdogSec@ NotifyAccess=main -#RestartSec=2 -#Restart=always +LimitCORE=infinity [Install] -WantedBy=multi-user.target +WantedBy=basic.target -- cgit v1.2.1