![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Include PERL script with in the unix shell script | ganapati | UNIX for Dummies Questions & Answers | 1 | 04-29-2008 01:18 PM |
| Maintain full path of a script in a var when sourcing it from a different script | mrbluegreen | Shell Programming and Scripting | 4 | 03-19-2008 10:31 PM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
| check in unix shell script so that no one is able to run the script manually | adi_bang76 | Shell Programming and Scripting | 1 | 11-16-2006 10:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need help in wwarning script very urgent
Hi
I have a file that contains some 24 key(encryption) id and their expiry date in the consequent lines The pattern is as follows Key ID: Expires: Now i need to write a script for warning the admins 2 months before the key expiry. Please help... Last edited by Gayathri22; 03-19-2008 at 04:48 AM.. |
|
||||
|
This would get you going... Of course , please modify according to your needs...
Code:
# Arg_1 = [DAYS:-1]
{
days=${1:-1}
date_d=`date +%d`
date_m=`date +%m`
date_y=`date +%Y`
#--------------------------------
# Days Back Size Test
#--------------------------------
if [ $days -lt $date_d ]
then
date_d=`expr $date_d - $days`
else
days=`expr $days - $date_d`
date_m=`expr $date_m - 1`
month_length=`s_month_length $date_m`
while [ $days -gt $month_length ]
do
days=`expr $days - month_length`
date_m=`expr $date_m - 1`
month_length=`s_month_length $date_m`
done
date_d=`expr $month_length - $days`
fi
#--------------------------------
# Date String Padding
#--------------------------------
if [ $date_d -lt 10 ]
then
date_d="0"$date_d
fi
if [ $date_m -lt 10 ]
then
date_m="0"$date_m
fi
echo $date_y $date_m $date_d
}
Last edited by Yogesh Sawant; 03-19-2008 at 04:01 AM.. Reason: added code tags |
|
||||
|
i have some 6 lines in the file of the pattern
1 Key Details: ADOBEB2B-IK-001 <info-security@adobe.com> Expires: 2008-03-14 ok. Now i need to retrieve only the date and compare the date with the current date and send mails to the admins saying that the particular key is going to expire in 2months |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|