Sponsored Content
Top Forums Shell Programming and Scripting Get a given date and subtract it to 5 days ago Post 303012997 by nms on Tuesday 13th of February 2018 01:55:28 PM
Old 02-13-2018
Get a given date and subtract it to 5 days ago

Hi all,

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.

Code:
[matt@server]# curl --proxy http://x.x.x.x:xxxx --insecure -v https://matt.com/ 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }' | grep "expire date"
*       expire date: Feb 13 23:59:59 2019 GMT

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:

Code:
 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?

Rgds,

Matthew
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

date for two days or 3 days ago

i need a script that can tell me the date 2 days ago or 3 days ago. please help (7 Replies)
Discussion started by: tomjones
7 Replies

2. Shell Programming and Scripting

Subtract days from a variable holding date

Hi, could someone help on this.. I have a date in variable procdate="05/30/2009" I would want to Subtract it with 3 or 4 (2 Replies)
Discussion started by: infernalhell
2 Replies

3. Shell Programming and Scripting

how to get what date was 28 days ago of the current system date IN UNIX

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)
Discussion started by: kandi.reddy
15 Replies

4. Shell Programming and Scripting

Date within a timeframe 2 days ago

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)
Discussion started by: freddie999
7 Replies

5. Shell Programming and Scripting

Calculating 7 days ago date for the given Argument

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)
Discussion started by: filter
10 Replies

6. UNIX for Advanced & Expert Users

Subtract days to a date in AIX 5.3

good afternoon, can someone help me, I need to make a script where n subtract days to a date. I am using AIX 5.3. Greetings. (4 Replies)
Discussion started by: systemoper
4 Replies

7. Shell Programming and Scripting

Subtract 2 date columns in .csv file and get output as number of days

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)
Discussion started by: Dimple
9 Replies

8. Shell Programming and Scripting

Subtract months/days from date

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)
Discussion started by: tostay2003
1 Replies

9. UNIX for Beginners Questions & Answers

How to find a file that's modified more than 2 days ago but less than 5 days ago?

How to find a file that's modified more than 2 days ago but was modified less than 5 days ago by use of any Linux utility ? (4 Replies)
Discussion started by: abdulbadii
4 Replies

10. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

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)
Discussion started by: kmarcus
20 Replies
CURLOPT_USE_SSL(3)					     curl_easy_setopt options						CURLOPT_USE_SSL(3)

NAME
CURLOPT_USE_SSL - request using SSL / TLS for the transfer SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_USE_SSL, long level); DESCRIPTION
Pass a long using one of the values from below, to make libcurl use your desired level of SSL for the transfer. These are all protocols that start out plain text and get "upgraded" to SSL using the STARTTLS command. This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc. CURLUSESSL_NONE Don't attempt to use SSL. CURLUSESSL_TRY Try using SSL, proceed as normal otherwise. CURLUSESSL_CONTROL Require SSL for the control connection or fail with CURLE_USE_SSL_FAILED. CURLUSESSL_ALL Require SSL for all communication or fail with CURLE_USE_SSL_FAILED. DEFAULT
CURLUSESSL_NONE PROTOCOLS
FTP, SMTP, POP3, IMAP EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/file.ext"); /* require use of SSL for this, or fail */ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); /* Perform the request */ curl_easy_perform(curl); } AVAILABILITY
Added in 7.11.0. This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants were known as CURLFTPSSL_* RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
CURLOPT_SSLVERSION(3), CURLOPT_SSL_OPTIONS(3), libcurl 7.54.0 February 03, 2016 CURLOPT_USE_SSL(3)
All times are GMT -4. The time now is 10:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy