dae: copied from immortalwrt
This commit is contained in:
commit
6c536e3c19
4 changed files with 197 additions and 0 deletions
7
net/dae/files/dae.config
Normal file
7
net/dae/files/dae.config
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
config dae 'config'
|
||||
option enabled '0'
|
||||
option config_file '/etc/dae/config.dae'
|
||||
option log_maxbackups '1'
|
||||
option log_maxsize '1'
|
||||
|
56
net/dae/files/dae.init
Normal file
56
net/dae/files/dae.init
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
extra_command "hot_reload" "Hot-reload service"
|
||||
|
||||
CONF="dae"
|
||||
PROG="/usr/bin/dae"
|
||||
LOG_DIR="/var/log/dae"
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
local enabled
|
||||
config_get_bool enabled "config" "enabled" "0"
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
local config_file
|
||||
config_get config_file "config" "config_file" "/etc/dae/config.dae"
|
||||
|
||||
"$PROG" validate -c "$config_file" || return 1
|
||||
|
||||
local log_maxbackups log_maxsize
|
||||
config_get log_maxbackups "config" "log_maxbackups" "1"
|
||||
config_get log_maxsize "config" "log_maxsize" "1"
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param command "$PROG" run
|
||||
procd_append_param command --config "$config_file"
|
||||
procd_append_param command --disable-timestamp
|
||||
procd_append_param command --logfile "$LOG_DIR/dae.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"
|
||||
procd_set_param respawn
|
||||
# procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
rm -rf "$LOG_DIR"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
|
||||
hot_reload() {
|
||||
"$PROG" reload "$(cat /var/run/dae.pid)"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue