minidlna: decrease minidlna log verbosity
Some clients do not close connections properly or do not keep
it alive, so each time the connection times out a corresponding
log entry is written into a log. These messages may spam the log
really hard.
This may be an issue if log is placed on internal flash - it may
prematurely wear a flash chip. This also prevents hdd from spinning
down if the log is located on hdd and the dlna capable tv is online.
Set the log level to "error" by default.
MAN:
Set this to change the verbosity of the information that is logged
each section can use a different level: off, fatal, error, warn,
info, or debug
Example
log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
Signed-off-by: Pavel Kubelun <be.dissent@gmail.com>
7 years ago |
|
- #!/bin/sh /etc/rc.common
- # Copyright (C) 2010 OpenWrt.org
-
- START=50
-
- SERVICE_USE_PID=1
- SERVICE_PID_FILE=/var/run/minidlna/minidlna.pid
-
- MINIDLNA_CONFIG_FILE="/tmp/minidlna.conf"
-
- minidlna_cfg_append() {
- echo "$1" >> "$MINIDLNA_CONFIG_FILE"
- }
-
- minidlna_cfg_addbool() {
- local cfg="$1"
- local key="$2"
- local def="$3"
- local val
-
- config_get_bool val "$cfg" "$key" "$def"
- [ "$val" -gt 0 ] && val="yes" || val="no"
- minidlna_cfg_append "$key=$val"
- }
-
- minidlna_cfg_addstr() {
- local cfg="$1"
- local key="$2"
- local def="$3"
- local val
-
- config_get val "$cfg" "$key" "$def"
- [ -n "$val" ] && minidlna_cfg_append "$key=$val"
- }
-
- minidlna_cfg_add_media_dir() {
- local val=$1
-
- minidlna_cfg_append "media_dir=$val"
- }
-
- minidlna_create_config() {
- local cfg=$1
- local port
- local interface
-
- config_get port $cfg port
- config_get interface $cfg interface
-
- [ -z "$interface" -o -t "$port" ] && return 1
-
- echo "# this file is generated automatically, don't edit" > "$MINIDLNA_CONFIG_FILE"
-
- minidlna_cfg_append "port=$port"
- minidlna_cfg_append "network_interface=$interface"
-
- minidlna_cfg_addstr $cfg friendly_name
- minidlna_cfg_addstr $cfg db_dir
- minidlna_cfg_addstr $cfg log_dir
- minidlna_cfg_addstr $cfg log_level 'error'
- minidlna_cfg_addbool $cfg inotify '1'
- minidlna_cfg_addbool $cfg enable_tivo '0'
- minidlna_cfg_addbool $cfg wide_links '0'
- minidlna_cfg_addbool $cfg strict_dlna '0'
- minidlna_cfg_addstr $cfg album_art_names
- minidlna_cfg_addstr $cfg presentation_url
- minidlna_cfg_addstr $cfg notify_interval '900'
- minidlna_cfg_addstr $cfg serial '12345678'
- minidlna_cfg_addstr $cfg model_number '1'
- minidlna_cfg_addstr $cfg minissdpsocket
- minidlna_cfg_addstr $cfg root_container '.'
- config_list_foreach "$cfg" "media_dir" minidlna_cfg_add_media_dir
-
- return 0
- }
-
- start() {
- local enabled
- local db_dir
- local log_dir
-
- config_load 'minidlna'
- config_get_bool enabled config 'enabled' '0'
-
- [ "$enabled" -gt 0 ] || return 1
-
- minidlna_create_config config || return 1
-
- config_get db_dir config 'db_dir' '/var/run/minidlna'
- config_get log_dir config 'log_dir' '/var/log'
-
- mkdir -m 0755 -p $db_dir
- mkdir -m 0755 -p $log_dir
- service_start /usr/bin/minidlna -f "$MINIDLNA_CONFIG_FILE"
- }
-
- stop() {
- service_stop /usr/bin/minidlna
- }
|