I have been researching to obtain SSL certification expiry for most of our webistes. For some cases, some hosts where not directly accessible so i finally got a solution working with curl using my proxy. This lists the expiry date which i'm finally looking for.
The next step is to try to find a way to get notified 5 days before that date (no emails).
First thoughts are to extract the date using awk/sed from the above result and convert it to epoch:
date --date="13-Feb-19" +%s
1550012400
Then i was thinking to somehow subtract this date to 5 days ago and convert it to epoch time. With both values in hand i subtract and the difference will be the said threshold. if less then, it means less then 5 days prior to expiry.
However i don't see how we can get a GIVEN date and subtract.
Do you have some thoughts or maybe other ideas?
Gnu date will be able to parse the initial expiry date string, ie Feb 13 23:59:59 2019 GMT without the need to munge it into, eg 13-Feb-19 . All the suggestions in the above examples should work just as well with that initial string.