aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/ubox/files/log.init
diff options
context:
space:
mode:
Diffstat (limited to 'package/system/ubox/files/log.init')
-rw-r--r--package/system/ubox/files/log.init18
1 files changed, 7 insertions, 11 deletions
diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init
index ae5dd1f03d..250f805b44 100644
--- a/package/system/ubox/files/log.init
+++ b/package/system/ubox/files/log.init
@@ -11,7 +11,7 @@ PROG=/sbin/logread
validate_log_section()
{
- uci_validate_section system system "${1}" \
+ uci_load_validate system system "$1" "$2" \
'log_file:string' \
'log_size:uinteger' \
'log_hostname:string' \
@@ -25,15 +25,13 @@ validate_log_section()
validate_log_daemon()
{
- uci_validate_section system system "${1}" \
+ uci_load_validate system system "$1" "$2" \
'log_size:uinteger:0' \
'log_buffer_size:uinteger:0'
}
start_service_daemon()
{
- local log_buffer_size log_size
- validate_log_daemon "${1}"
[ $log_buffer_size -eq 0 -a $log_size -gt 0 ] && log_buffer_size=$log_size
[ $log_buffer_size -eq 0 ] && log_buffer_size=64
procd_open_instance
@@ -47,9 +45,8 @@ start_service_file()
{
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
local pid_file="/var/run/logread.${PIDCOUNT}.pid"
- local log_file log_size
- validate_log_section "${1}" || {
+ [ "$2" = 0 ] || {
echo "validation failed"
return 1
}
@@ -67,9 +64,8 @@ start_service_remote()
{
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
local pid_file="/var/run/logread.${PIDCOUNT}.pid"
- local log_ip log_port log_proto log_prefix log_remote log_trailer_null log_hostname
- validate_log_section "${1}" || {
+ [ "$2" = 0 ] || {
echo "validation failed"
return 1
}
@@ -96,7 +92,7 @@ service_triggers()
start_service()
{
config_load system
- config_foreach start_service_daemon system
- config_foreach start_service_file system
- config_foreach start_service_remote system
+ config_foreach validate_log_daemon system start_service_daemon
+ config_foreach validate_log_section system start_service_file
+ config_foreach validate_log_section system start_service_remote
}