Fri, 01 May 2020 15:27:45 +0100
Initial commit
0 | 1 | #!/bin/bash |
2 | ||
3 | trap 'kill %1;' SIGTERM | |
4 | ||
5 | log() { | |
6 | echo "$(date +"%F %R"): $@" | |
7 | } | |
8 | ||
9 | run_certwatch() { | |
10 | log "Executing checks at $(date +"%F %R")..." | |
11 | /usr/local/bin/certwatch.sh | |
12 | case "$?" in | |
13 | 0) log "PASS: All checks passed" ;; | |
14 | 2) log "FAIL: One or more checks failed" ;; | |
15 | *) log "ERROR: There was an error executing the checks" ;; | |
16 | esac | |
17 | } | |
18 | ||
19 | log "Hello and welcome to certwatch!" | |
20 | ||
21 | ( | |
22 | run_certwatch; | |
23 | ||
24 | while sleep 86400; do | |
25 | run_certwatch; | |
26 | done; | |
27 | ) & | |
28 | ||
29 | wait %1 | |
30 | ||
31 | log "Exiting..." | |
32 | ||
33 | exit 0; |