1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2014 - 2018 OpenWrt.org
7 COMMAND
=/usr
/sbin
/$NAME
10 PIDFILE
=$RUNDIR/$NAME.pid
12 LOG_ERR
="/usr/bin/logger -p user.err -s -t $NAME"
28 $LOG_ERR empty
$type entry
32 # IPv6 addresses need to be enclosed in square brackets. If there are
33 # square brackets in the listen entry, just copy it.
34 echo "$value" |
grep "\[[0-9:A-Fa-f]*\]" &> /dev
/null
&& {
35 options
=$options" -l $value"
39 # Bail if more than 2 colons.
40 [ $
(echo "$value" |
awk -F ":" '{print NF-1}') -gt 2 ] && {
41 $LOG_ERR init
script does not understand
$type entry
\""$value"\"
45 IFS
=":" read one two three
<< EOF
59 if [ "$type" = "listen" ]; then
60 network_get_ipaddr address
"$tmp" || address
="$tmp"
62 network_get_ipaddr6 address
"$tmp" && address
="[$address]" || \
66 if [ -n "$three" ]; then
67 tmp
="$one:$address:$three"
68 elif [ -n "$two" ]; then
69 if [ $has_proto = 1 ]; then
78 options
=$options" -l $tmp"
92 config_get_bool enabled general enabled
0
94 if [ $enabled -eq 0 ]; then
95 $LOG_ERR service not enabled
in /etc
/config
/$NAME
99 config_get user general user
$NAME
100 config_get group general group
$NAME
101 config_get shm_memory general shm_memory
8
102 config_get pkg_memory general pkg_memory
2
103 config_get cfg_file general cfg_file
/etc
/$NAME/$NAME.cfg
104 config_get options general options
106 .
/lib
/functions
/network.sh
108 config_list_foreach general listen check_listen listen
109 config_list_foreach general listen6 check_listen listen6
111 if [ ! -d $RUNDIR ]; then
113 chown
"$user":"$group" $RUNDIR
117 procd_set_param
command $COMMAND
118 procd_append_param
command \
127 # forward stderr to logd
128 procd_set_param stderr
1