From eeeba2aa2015daa2123f1b73e5ec696aa615b002 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Fri, 21 Jul 2023 00:04:29 +0800 Subject: [PATCH] daed: add logging support Co-authored-by: douglarek Signed-off-by: Tianling Shen (cherry picked from commit e1af07deefe3982926971720193210fd36e00778) --- net/daed/Makefile | 2 +- net/daed/files/daed.config | 2 ++ net/daed/files/daed.init | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/net/daed/Makefile b/net/daed/Makefile index 356e1ee596..702f18e133 100644 --- a/net/daed/Makefile +++ b/net/daed/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=daed PKG_VERSION:=0.2.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/daeuniverse/daed.git diff --git a/net/daed/files/daed.config b/net/daed/files/daed.config index 83322e68f0..ff61f36391 100644 --- a/net/daed/files/daed.config +++ b/net/daed/files/daed.config @@ -2,4 +2,6 @@ config daed 'config' option enabled '0' option listen_addr '0.0.0.0:2023' + option log_maxbackups '1' + option log_maxsize '5' diff --git a/net/daed/files/daed.init b/net/daed/files/daed.init index ab1dcb0f05..baa72884ee 100644 --- a/net/daed/files/daed.init +++ b/net/daed/files/daed.init @@ -6,6 +6,7 @@ START=99 CONF="daed" PROG="/usr/bin/daed" +LOG="/var/log/daed/daed.log" start_service() { config_load "$CONF" @@ -14,13 +15,18 @@ start_service() { config_get_bool enabled "config" "enabled" "0" [ "$enabled" -eq "1" ] || return 1 - local listen_addr + local listen_addr log_maxbackups log_maxsize config_get listen_addr "config" "listen_addr" "0.0.0.0:2023" + config_get log_maxbackups "config" "log_maxbackups" "1" + config_get log_maxsize "config" "log_maxsize" "5" procd_open_instance "$CONF" procd_set_param command "$PROG" run procd_append_param command --config "/etc/daed/" procd_append_param command --listen "$listen_addr" + procd_append_param command --logfile "$LOG" + procd_append_param command --logfile-maxbackups "$log_maxbackups" + procd_append_param command --logfile-maxsize "$log_maxsize" procd_set_param limits core="unlimited" procd_set_param limits nofile="1000000 1000000" @@ -31,6 +37,10 @@ start_service() { procd_close_instance } +stop_service() { + rm -f "$LOG" +} + service_triggers() { procd_add_reload_trigger "$CONF" }