#!/usr/bin/perl

# send email to update about to-do items

use strict;

my $QUEUE_DIR = "/usr/local/www/tech_queue_data";
my $LOG_FILE = "/usr/local/www/tech_queue.log";

my @RECIPIENTS = qw ( 
		     matt
		     kelleyc
		     cady
		    );

my $counts = `ls $QUEUE_DIR | wc -l`;
$counts =~ s/\s+//g;

my $date = `date`;
$date =~ s/\s+$//;
$date =~ s/^\s+//;

foreach my $person (@RECIPIENTS) {
   open EMAIL, "|mail -s \"Tech Report for $date\" $person" || die $!;
   print EMAIL "\nThere are $counts items in the technology queue:\n\n";
   print EMAIL "\thttp://otc.isu.edu/queue\n\n";
   print EMAIL "Here are the last ten log entries:\n\n";
   print EMAIL `tail -10 $LOG_FILE`;
   print EMAIL "\n\nThis is an automatic message; please don't reply.\n\n";
   close EMAIL;
}

exit (0);


