Clear out keyserver logs more frequently and make sure that sks daemon is stopped when clearing

This commit is contained in:
Bob Mottram 2017-07-31 11:53:03 +01:00
parent 4398c8b976
commit a361727da6
2 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,8 @@ function keyserver_watchdog {
keyserver_mail_subject_line=$"${PROJECT_NAME} keyserver warning"
keyserver_mail_subject_line_disabled=$"${PROJECT_NAME} keyserver disabled"
read_config_param KEYSERVER_DOMAIN_NAME
# check database size hourly
keyserver_watchdog_script=/etc/cron.hourly/keyserver-watchdog
echo '#!/bin/bash' > $keyserver_watchdog_script
echo "dirsize=\$(du /var/lib/sks/DB | awk -F ' ' '{print \$1}')" >> $keyserver_watchdog_script
@ -80,6 +82,17 @@ function keyserver_watchdog {
echo 'fi' >> $keyserver_watchdog_script
chmod +x $keyserver_watchdog_script
# clear out log files daily
keyserver_watchdog_script=/etc/cron.daily/keyserver-db
echo '#!/bin/sh' > $keyserver_watchdog_script
echo 'if [ -d /var/lib/sks/DB ]; then' >> $keyserver_watchdog_script
echo ' cd /var/lib/sks/DB' >> $keyserver_watchdog_script
echo ' systemctl stop sks' >> $keyserver_watchdog_script
echo ' db_archive -d' >> $keyserver_watchdog_script
echo ' systemctl start sks' >> $keyserver_watchdog_script
echo 'fi' >> $keyserver_watchdog_script
chmod +x $keyserver_watchdog_script
}

View File

@ -70,7 +70,9 @@ update-ca-certificates
# remove any keyserver log files
if [ -d /var/lib/sks/DB ]; then
cd /var/lib/sks/DB
systemctl stop sks
db_archive -d
systemctl start sks
fi
if [ ! -d $PROJECT_DIR ]; then