entrypoint.sh

Fri, 01 May 2020 15:27:45 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 01 May 2020 15:27:45 +0100
changeset 0
e6c11dadd985
permissions
-rwxr-xr-x

Initial commit

#!/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;

mercurial