main: return code increments on number of alerted certs

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2025-02-15 12:10:43 -05:00
parent 82905131cc
commit 3bdddaa253
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED

View file

@ -11,6 +11,7 @@ import (
) )
func main() { func main() {
var retCode int = 0
fDays := flag.Int("d", 20, "number of days to alert on") fDays := flag.Int("d", 20, "number of days to alert on")
fDebug := flag.Bool("D", false, "debug mode") fDebug := flag.Bool("D", false, "debug mode")
@ -60,6 +61,7 @@ func main() {
log.Warnf("%q : TIME TO RENEW CERTIFICATE (expires in less than %d days)", file, *fDays) log.Warnf("%q : TIME TO RENEW CERTIFICATE (expires in less than %d days)", file, *fDays)
log.Infof("%q : %v", file, cert.NotAfter) log.Infof("%q : %v", file, cert.NotAfter)
log.Infof("%q : %v", file, cert.DNSNames) log.Infof("%q : %v", file, cert.DNSNames)
retCode += 1
} else { } else {
log.Debugf("%q : %v", file, cert.NotAfter) log.Debugf("%q : %v", file, cert.NotAfter)
log.Debugf("%q : %v", file, cert.DNSNames) log.Debugf("%q : %v", file, cert.DNSNames)
@ -67,4 +69,5 @@ func main() {
} }
} }
os.Exit(retCode)
} }