# #-- log_servfail.pre--#
PRE="../.."
. ../common.sh

get_random_port 2
SERVER_PORT=$RND_PORT
CONTROL_PORT=$(($RND_PORT + 1))
echo "SERVER_PORT=$SERVER_PORT" >> .tpkg.var.test
echo "CONTROL_PORT=$CONTROL_PORT" >> .tpkg.var.test

# make config file
sed \
	-e 's/@SERVER_PORT\@/'$SERVER_PORT'/' \
	-e 's/@CONTROL_PORT\@/'$CONTROL_PORT'/' \
	< log_servfail.conf > ub.conf

# start unbound in the background
$PRE/unbound -d -c ub.conf > unbound.log 2>&1 &

cat .tpkg.var.test
wait_unbound_up unbound.log
