1
1
mirror of https://github.com/dnscrypt/dnscrypt-server-docker synced 2024-11-22 19:42:03 +01:00
dnscrypt-server-docker/key-rotation.sh

19 lines
433 B
Bash
Raw Normal View History

#! /usr/bin/env bash
2015-07-06 01:39:54 +02:00
sleep 1800
KEYS_DIR="/opt/dnscrypt-wrapper/etc/keys"
STKEYS_DIR="${KEYS_DIR}/short-term"
rotation_needed() {
if [ "$(/usr/bin/find "$STKEYS_DIR" -type f -cmin -720 -print -quit | wc -l | sed 's/[^0-9]//g')" -le 0 ]; then
2015-07-06 01:39:54 +02:00
echo true
else
echo false
fi
}
[ "$(rotation_needed)" = true ] || exit 0
sv status dnscrypt-wrapper | grep -E -q '^run:' || exit 0
2015-07-06 01:39:54 +02:00
sv restart dnscrypt-wrapper