Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daed: Support logging to a file #800

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions net/daed/files/daed.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
config daed 'config'
option enabled '0'
option listen_addr '0.0.0.0:2023'
option logfile_enabled '1'
option logfile_maxbackups '1'
option logfile_maxsize '1'

18 changes: 18 additions & 0 deletions 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"
RUN_DIR="/var/run/daed"

start_service() {
config_load "$CONF"
Expand All @@ -22,6 +23,19 @@ start_service() {
procd_append_param command --config "/etc/daed/"
procd_append_param command --listen "$listen_addr"

local logfile_enabled
config_get_bool logfile_enabled "config" "logfile_enabled" "1"
if [ "$logfile_enabled" != "0"] ; then
local logfile_maxbackups
config_get logfile_maxbackups "config" "logfile_maxbackups" "1"
local logfile_maxsize
config_get logfile_maxsize "config" "logfile_maxsize" "1"
mkdir -p "$RUN_DIR"
procd_append_param command --logfile "$RUN_DIR/daed.log"
procd_append_param command --logfile-maxbackups "$logfile_maxbackups"
procd_append_param command --logfile-maxsize "$logfile_maxsize"
fi

procd_set_param limits core="unlimited"
procd_set_param limits nofile="1000000 1000000"
procd_set_param respawn
Expand All @@ -31,6 +45,10 @@ start_service() {
procd_close_instance
}

stop_service() {
rm -f "$RUN_DIR/daed.log"
}

service_triggers() {
procd_add_reload_trigger "$CONF"
}
Loading