40 lines
750 B
Bash
Executable File
40 lines
750 B
Bash
Executable File
#!/bin/sh
|
|
|
|
LOGS=${LOGS:-false}
|
|
LOGDIR=${LOGDIR:-/logs}
|
|
PORT=${PORT:-1053}
|
|
VERBOSITY=${VERBOSITY:-1}
|
|
|
|
# set logs
|
|
if [ "${LOGS}" = true ] ; then
|
|
mkdir -p "${LOGDIR}"
|
|
chown unbound:unbound "${LOGDIR}"
|
|
cat >> /etc/unbound/unbound.conf.d/logs.conf << EOF
|
|
server:
|
|
verbosity: ${VERBOSITY}
|
|
log-queries: yes
|
|
log-replies: yes
|
|
logfile: "${LOGDIR}/unbound.log"
|
|
log-time-ascii: yes
|
|
log-servfail: yes
|
|
log-local-actions: yes
|
|
EOF
|
|
else
|
|
cat >> /etc/unbound/unbound.conf.d/logs.conf << EOF
|
|
server:
|
|
verbosity: ${VERBOSITY}
|
|
log-queries: no
|
|
log-replies: no
|
|
logfile: ""
|
|
EOF
|
|
fi
|
|
|
|
# set port
|
|
cat >> /etc/unbound/unbound.conf.d/port.conf << EOF
|
|
server:
|
|
port: ${PORT}
|
|
EOF
|
|
|
|
# start unbound
|
|
/usr/sbin/unbound -d
|