Skip to content

Instantly share code, notes, and snippets.

@se7enack
Created February 19, 2026 18:17
Show Gist options
  • Select an option

  • Save se7enack/ee651398dbad59602a868f7040e633ba to your computer and use it in GitHub Desktop.

Select an option

Save se7enack/ee651398dbad59602a868f7040e633ba to your computer and use it in GitHub Desktop.
apiVersion: batch/v1
kind: CronJob
metadata:
name: check-ssl-expiration
namespace: default
spec:
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- command:
- /bin/sh
- -c
- echo "today=\$(date +%Y-%m-%d);months=\"Jan Feb Mar Apr May Jun Jul
Aug Sep Oct Nov Dec\";x=\$(echo -n \$1' ';curl --insecure -vvI https://\${1}
2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ {
if (cert) print }' | grep expire|awk -F \":\" '{print \$2 \"\" \$4}'
| awk '{print \$4\"-\"\$1\"-\"\$2}');month=\$(echo \$x | awk '{print
\$2}' | awk -F '-' '{print \$2}');nummonth=\$(string=\"\${months%\$month*}\"
&& echo -n \"\$((\${#string}/4 + 1))\");entry=\$(echo -n \$x | awk -v
ORS=\" \" '{print \$1}'; echo -n \$x | awk '{print \$2}' | awk -v ORS=\"\"
-F '-' '{print \$1\"-\"}'; echo -n \$nummonth;echo -n \$x | awk '{print
\$2}' | awk -F '-' '{print \"-\"\$3}');entrydate=\$(echo \$entry | awk
'{print \$2}');echo \"\$x\";daysleft=\$(echo -n \$(date -d \"\$entrydate\"
\+\%s 2>/dev/null) \$(date -d \"\$today\" \+\%s 2>/dev/null) | awk -v
ORS=\"\" '{print (\$1 - \$2) / 86400}');if [ \"\$daysleft\" -le \"$daythreshold\"
]; then curl -X POST --data '{\"text\":\"'\"The SSL certificate for
https://\${1} will expire in \${daysleft} days!\"'\"}' $slackurl; fi"
> /tmp/expires;chmod +x /tmp/expires;for DOMAIN in [ $check ]; do /tmp/expires
$DOMAIN | grep -vE '\]|\[' >> list.txt; done;cat list.txt | awk '{print
$2 " " $1}' | sort;rm -rf list.txt
env:
- name: check
value: sb2.cache.getburke.com sb2.cdn.getburke.com sb2.getburke.com
cloud.getburke.com sb1.cache.getburke.com sb1.cdn.getburke.com
sb1.getburke.com sb3.cache.getburke.com sb3.cdn.getburke.com
sb3.getburke.com burke.mo.cache.getburke.com burke.mo.cdn.getburke.com
burke.mo.getburke.com burke.v1.getburke.com burke.v10.getburke.com
burke.v11.getburke.com burke.v12.getburke.com burke.v13.getburke.com
burke.v14.getburke.com burke.v15.getburke.com burke.v16.getburke.com
burke.v2.getburke.com burke.v3.getburke.com burke.v4.getburke.com
burke.v5.getburke.com burke.v6.getburke.com burke.v7.getburke.com
burke.v8.cdn.getburke.com burke.v8.getburke.com burke.v9.getburke.com
burke.vops.getburke.com burke.vp.cdn.getburke.com burke.vp.getburke.com
burke.vp2.getburke.com burke.vp3.cdn.getburke.com burke.vp3.getburke.com
burke.vqa.cdn.getburke.com burke.vqa.getburke.com burke.vstaging.cdn.getburke.com
burke.vstaging.getburke.com onepatch.getburke.com onep1.getburke.com
link.getburke.com pie.getburke.com
- name: daythreshold
value: "35"
- name: slackurl
value: https://hooks.slack.com/services/????????????/????????????/????????????
image: curlimages/curl:8.2.0
imagePullPolicy: IfNotPresent
name: check-ssl-expiration
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: OnFailure
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
schedule: 00 17 * * 1-5
successfulJobsHistoryLimit: 1
suspend: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment