#!/bin/sh

set -o errexit
#set -o pipefail
set -o nounset
set -o xtrace

# RPKI database becomes big/stale/corrupt(?) as the system ages leading to loss
# of function
#
# clear it for now and let the rpki-validator process rebuild it from the local
# rsync repository

DB_DIR='/var/lib/rpki-validator/db'
AFTER_STOP_DELAY=60

service rpki-validator stop
sleep $AFTER_STOP_DELAY
find $DB_DIR -maxdepth 1 -type f -print0 |
	xargs --null --no-run-if-empty rm --verbose --
service rpki-validator start
