#!/usr/bin/env bash
# clear full cache
-kresctl cache clear
+kresctl cache clear > /dev/null
if [ "$?" -ne "0" ]; then
echo "Could not clear full cache"
exit 1
fi
# clear just example.com. AAAA record, get JSON output
-kresctl cache clear --json --exact-name --rr-type AAAA example.com. | python3 -m json.tool
+kresctl cache clear --json --exact-name --rr-type AAAA example.com. | python3 -m json.tool > /dev/null
if [ "$?" -ne "0" ]; then
echo "Could not clear example.com. AAAA record or output is not a valid JSON"
exit 1
socket_opt="--unix-socket /run/knot-resolver/kres-api.sock"
-echo " etag"
etag="$(curl --silent $socket_opt --fail http://localhost:5000/v1/config -o /dev/null -v 2>&1 | grep ETag | sed 's/< ETag: //;s/\s//')"
-echo " etag OK"
-echo " status"
status=$(curl --silent $socket_opt --fail http://localhost:5000/v1/config --header "If-None-Match: $etag" -w "%{http_code}" -o /dev/null)
test "$status" -eq 304
-echo " status OK"
curl --silent --fail --unix-socket /run/knot-resolver/kres-api.sock http://localhost/metrics > /dev/null
-kresctl metrics
+kresctl metrics > /dev/null
if [ "$?" -ne "0" ]; then
echo "Could not get metrics in JSON format"
exit 1
fi
-kresctl metrics --prometheus
+kresctl metrics --prometheus > /dev/null
if [ "$?" -ne "0" ]; then
echo "Could not get metrics in Prometheus format"
exit 1
-#!/bin/bash
+#!/usr/bin/env bash
set -e
-kresctl schema
+kresctl schema > /dev/null
if [ "$?" -ne "0" ]; then
echo "Failed to generate JSON schema with 'kresctl'"
exit 1
fi
-kresctl schema --live
+kresctl schema --live > /dev/null
if [ "$?" -ne "0" ]; then
echo "Failed to get JSON schema from the running resolver"
exit 1