Intranet - keeping up-to-date automatically

I am struggling with the following:
Each page on our intranet has a line of text which reads something like
Document: H&S Policy: Author: Fred Bloggs: Dated: 13/04/1999: Expires: 13/01/2000: Notify: bloggsf@mail.address
I have used shell to trawl through all the pages and pull out this line from each one. I'm stuck now trying to use the resulting text file to email the user as the page approaches it's expiry date. Am I barking up the wrong tree ?
We run RedHat Linux 6 and Apache (if that makes any difference!)
Thanks
Lou
louobrienAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
open PAGE,"<$page" or die "can't open $page because $!";
($d,$m,$y) = (localtime time+4*24*60*60)[3,4,5];
$approach = sprintf("%d/%02d/%02d",$y+1900,$m+1,$d);
while( <PAGE> ){
    next unless ($Document,$Author,$Dated,$Expires,$Notify) = /Document: (.*): Author: (.*): Dated: (.*): Expires: (.*): Notify: (.*)/;
    next unless $approach le join"/",reverse split"/",$Expires;
    open MAIL,"|/usr/bin/sendmail -t";
    print MAIL,<<END_HERE;
To: $Notify
Subject: $Document

$page:$_
approaches expiration date
END_HERE
    close MAIL;
}
0
 
mgfranzCommented:
Well with linux and apache you are pretty much limited to using a Perl script... I suppose something like a script that runs daily, checks the system date against a date in the file, if the date matches, mail an email to the user.  Shouldn't be too hard to hack something together.

Your text file will have to be seperated line by line with some sort of delimiter, then simple CSV to each field, doc, policy, author, dated, expires, notify,||

Your script will have to parse through each date field to see if it matched the system date, (not time though).  If true, run a SMTP mailer to notify the author of the impending expiration.  

Check with www.perl.com or www.cpan.org for previously written code.

Mark
0
 
nettromCommented:
and then simply add File::Find to what ozo suggested to crawl through the whole directory structure.
0
 
louobrienAuthor Commented:
Put me on the right track - thanks ozo
0
All Courses

From novice to tech pro — start learning today.