Skip to content

Commit

Permalink
daed: add logging support
Browse files Browse the repository at this point in the history
Co-authored-by: douglarek <[email protected]>
Signed-off-by: Tianling Shen <[email protected]>
(cherry picked from commit e1af07d)
  • Loading branch information
1715173329 committed Jul 20, 2023
1 parent 68a5cfb commit eeeba2a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/daed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions net/daed/files/daed.config
Original file line number Diff line number Diff line change
Expand Up @@ -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'

12 changes: 11 additions & 1 deletion net/daed/files/daed.init
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ START=99

CONF="daed"
PROG="/usr/bin/daed"
LOG="/var/log/daed/daed.log"

start_service() {
config_load "$CONF"
Expand All @@ -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"
Expand All @@ -31,6 +37,10 @@ start_service() {
procd_close_instance
}

stop_service() {
rm -f "$LOG"
}

service_triggers() {
procd_add_reload_trigger "$CONF"
}

0 comments on commit eeeba2a

Please sign in to comment.