Refresh gpg keys at a random time

This commit is contained in:
Bob Mottram 2016-05-02 10:01:46 +01:00
parent f87db99db6
commit 87f76b3edd
1 changed files with 3 additions and 2 deletions

View File

@ -5315,10 +5315,11 @@ function configure_gpg {
function refresh_gpg_keys {
if ! grep -q "${PROJECT_NAME}-sec --refresh" /etc/crontab; then
GPG_REFRESH_TIME=$(( RANDOM % 60 ))
if [ -f /usr/local/bin/freedombone-sec ]; then
echo "0 */$REFRESH_GPG_KEYS_HOURS * * * root /usr/local/bin/${PROJECT_NAME}-sec --refresh > /dev/null" >> /etc/crontab
echo "$GPG_REFRESH_TIME */$REFRESH_GPG_KEYS_HOURS * * * root /usr/local/bin/${PROJECT_NAME}-sec --refresh > /dev/null" >> /etc/crontab
else
echo "0 */$REFRESH_GPG_KEYS_HOURS * * * root /usr/bin/${PROJECT_NAME}-sec --refresh > /dev/null" >> /etc/crontab
echo "$GPG_REFRESH_TIME */$REFRESH_GPG_KEYS_HOURS * * * root /usr/bin/${PROJECT_NAME}-sec --refresh > /dev/null" >> /etc/crontab
fi
systemctl restart cron
fi