--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/entrypoint.sh Fri May 01 15:27:45 2020 +0100 @@ -0,0 +1,33 @@ +#!/bin/bash + +trap 'kill %1;' SIGTERM + +log() { + echo "$(date +"%F %R"): $@" +} + +run_certwatch() { + log "Executing checks at $(date +"%F %R")..." + /usr/local/bin/certwatch.sh + case "$?" in + 0) log "PASS: All checks passed" ;; + 2) log "FAIL: One or more checks failed" ;; + *) log "ERROR: There was an error executing the checks" ;; + esac +} + +log "Hello and welcome to certwatch!" + +( + run_certwatch; + + while sleep 86400; do + run_certwatch; + done; +) & + +wait %1 + +log "Exiting..." + +exit 0;