The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate details
Logic Requirement 1]
Write a shell/perl script to retrieve the data line by line from input file and compare the current date with the expiry date. If the validated difference in days is less than 7 days. The script must generate the email from the system/server and send the report to the end users.
Sample Data
server name | certificate name | start date | expiry date
cce-l3-na.lexington.ibm.com | verisign_class_3ppca | 11/07/2006 19:00:00 | 7/16/36 7:59 PM
cce-l3-na.lexington.ibm.com | wwwbeta335 | 5/17/07 6:38 PM | 8/16/11 6:38 PM
cce-l3-na.lexington.ibm.com | wi | 10/22/06 9:37 PM | 10/18/26 9:37 PM
cce-l3-na.lexington.ibm.com | verisignbluepages | 11/07/2006 19:00:00 | 7/16/36 7:59 PM
cce-l3-na.lexington.ibm.com | epricerjai | 05/08/2007 13:08:00 | 08/07/2010 13:08:00
cce-l3-na.lexington.ibm.com | ccel3na2011 | 03/02/2011 05:26:00 | 11/27/13 5:26 AM
cce-l3-na.lexington.ibm.com | entrustclientca | 10/12/1999 15:24:00 | 10/12/2019 15:54:00
cce-l3-na.lexington.ibm.com | verisignclass3g2ca | 5/17/98 8:00 PM | 08/01/2028 19:59:00
cce-l3-na.lexington.ibm.com | thawtepersonalbasicca | 12/31/95 7:00 PM | 12/31/20 6:59 PM
Let us assume - The current date is 8/12/11 and expiry date of the certificate is 8/16/11. In this example the difference between the expiry date and the current date is less than 7 days. So, the script must pick up this line data, design the mail as in the Email-example attached below and send the mail to the user. The date format is mm/dd/yy.
Note: If there are multiple certificates getting expired in the week, notify all the certificate and server details in the mail.
---------- Post updated at 09:01 AM ---------- Previous update was at 09:00 AM ----------
Please help urgently