diff --git a/backup b/backup index ab07891..ae6c9be 100755 --- a/backup +++ b/backup @@ -7,7 +7,7 @@ CRON="" if [ "$1" == "cron" ]; then CRON="${1}_" TODAY=`date '+%Y_%m_%d'` - echo "Running cron-backup for ${TODAY}..." + echo "Running cron-$(basename $0) for ${TODAY}..." fi BASE=${HOSTNAME}_${CRON}${NOW} TMPDIR=/tmp/$BASE diff --git a/smartrenew b/checkrenew similarity index 85% rename from smartrenew rename to checkrenew index 7c52e8c..aca4085 100755 --- a/smartrenew +++ b/checkrenew @@ -5,7 +5,7 @@ set -e RENEW=30 TODAY=`date '+%Y_%m_%d'` -echo "Running cron-smartrenew for ${TODAY}..." +echo "Running cron-$(basename $0) for ${TODAY}..." if ! expires=`openssl x509 -checkend $[ 86400 * $RENEW ] -noout -in /etc/nginx/ssl/labca_cert.pem`; then echo " renewing!" diff --git a/commander b/commander index 0746771..f62eab9 100755 --- a/commander +++ b/commander @@ -88,6 +88,10 @@ case $txt in [ -f $LOGFILE ] && tail -200 $LOGFILE || /bin/true exit 0 ;; +"log-cron") + [ -f /logs/cron.log ] && tail -n200 -f /logs/cron.log || /bin/true + exit 0 + ;; "log-boulder") cd /boulder docker-compose logs -f --no-color --tail=50 boulder diff --git a/control.sh b/control.sh index 8d5a968..d79d461 100755 --- a/control.sh +++ b/control.sh @@ -65,6 +65,9 @@ start_cron() { apt update apt install -y cron [ -e /boulder/labca/setup_complete ] && [ ! -e /etc/cron.d/labca ] && ln -sf /labca/cron_d /etc/cron.d/labca || true + [ -e /logs/cron.log ] && mv /logs/cron.log "/logs/cron.log-$(date +%y%m%d-%H%M%S)" || true + touch /logs/cron.log + tail -f /logs/cron.log & service cron start } diff --git a/cron_d b/cron_d index 8170f16..c9e6c1c 100644 --- a/cron_d +++ b/cron_d @@ -2,6 +2,6 @@ SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -1 6 * * Mon root /labca/backup cron -1 7 * * * root /labca/mailer -5 7 * * * root /labca/smartrenew +1 6 * * Mon root /labca/backup cron &>>/logs/cron.log +1 7 * * * root /labca/mailer &>>/logs/cron.log +5 7 * * * root /labca/checkrenew &>>/logs/cron.log diff --git a/gui/main.go b/gui/main.go index c255024..13bf213 100644 --- a/gui/main.go +++ b/gui/main.go @@ -1186,6 +1186,9 @@ func logsHandler(w http.ResponseWriter, r *http.Request) { case "audit": name = "ACME Audit Log" message = "Live view on only the audit messages in the backend ACME application (Boulder) logs." + case "cron": + name = "Cron Log" + message = "Live view on the logs for the cron jobs for LabCA." case "labca": name = "LabCA Log" message = "Live view on the logs for this LabCA web application." @@ -1315,6 +1318,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) { case "boulder": case "audit": case "labca": + case "cron": case "web": default: errorHandler(w, r, fmt.Errorf("unknown log type '%s'", logType), http.StatusBadRequest) @@ -2237,6 +2241,14 @@ func activeNav(active string, uri string, requestBase string) []navItem { "title": "Live view on the logs for this LabCA web application", }, } + cron := navItem{ + Name: "Cron Log", + Icon: "fa-clock", + Attrs: map[template.HTMLAttr]string{ + "href": requestBase + "/logs/cron", + "title": "Live view on the logs for the cron jobs for LabCA", + }, + } web := navItem{ Name: "Web Server", Icon: "fa-globe", @@ -2253,7 +2265,7 @@ func activeNav(active string, uri string, requestBase string) []navItem { "title": "Log Files", }, IsActive: strings.HasPrefix(uri, "/logs/"), - SubMenu: []navItem{cert, boulder, audit, labca, web}, + SubMenu: []navItem{boulder, audit, cron, labca, cert, web}, } manage := navItem{ Name: "Manage", diff --git a/mailer b/mailer index 4632920..7327bd1 100755 --- a/mailer +++ b/mailer @@ -3,7 +3,7 @@ set -e TODAY=`date '+%Y_%m_%d'` -echo "Running cron-mailer for ${TODAY}..." +echo "Running cron-$(basename $0) for ${TODAY}..." -cd /home/labca/boulder +cd /boulder docker-compose exec -T boulder bin/expiration-mailer --config labca/config/expiration-mailer.json 2>&1