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:
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.
current date command runs well
awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
subtract 30 days fails
awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Hi,
Can you please let me know code for the below (in korn shell)
a) Subtract month(s) from given date
b) Subtract day(s) from give date
c) Subtract month(s) from given timestamp
d) Subtract day(s) from give timestamp (1 Reply)
Hi,
I have one .csv file. I have 2 date columns present in file, column 2 and column 3.
I need to calculate how many days exist between 2 dates.
I am trying to subtract date column 2 from date column 3.
Eg: my file look likes
s.no, Start_date,End_Date
1, 7/29/2012,10/27/2012
2,... (9 Replies)
Hi
I have shell script and I am facing the below issue to integrate the date calculation to the the script.
If I give the $1 as the date(20110701) then I need to get the 7 days ago date for the same format.(20110624).
At first I thought its a simple one to handle and I did a search in the... (10 Replies)
How could I using the following example, change it to show 2 days ago within the same time frame 0600 AM to 0600 AM
let foo=`date "+(1%H-106)*60+1%M-100"` bar=foo+1440
find . -mmin +$foo -mmin -$bar | tr -s '/','-' '^' | cut -f2,3 -d"^" | tr -s '^' ' ' |
Please use code tags (7 Replies)
Hi,
Anybody knows how to get what date was 28 days ago of the current system date through UNIX script.
Ex : - If today is 28th Mar 2010 then I have to delete the files which arrived on 1st Mar 2010, (15 Replies)