36

Mivel nem csak számomra nagy jelentőségű ez a nap, hanem bizony Valentin nap is ma van, engedjétek meg, hogy egy igazi informatikus költeménnyel köszöntselek Titeket. A vers címe “Purge Static Webe Data”, és én írtam perl-ben. (Ajnálom figyelmetekbe a gyönyörűen kidolgozott jambikus verslábakat!)

#!/usr/bin/perl
use strict;
use Getopt::Long;
use File::Temp qw/ tempfile tempdir /;
use DBI;
use Crypt::TripleDES;
use MIME::Base64;
use LWP::UserAgent;
use File::Path 'rmtree';
use MIME::Lite;
use Net::Domain qw(hostname hostfqdn hostdomain);
my $PASSPHRASE = "HajraHonved";
my $CURRENT_CMP = -1;
my $market = '';
my @email_to = ();
my $filetosave = '';
my $configfile = '';
my @argv_copy = @ARGV;
GetOptions ("email=s" => \@email_to,
                        "help|?"   => \$help,
						"save=s"  => \$filetosave,
						"keepdays=i"  => \$keeplastxdays,
						"keepcampaigns=i"  => \$keeplastxcamp,
						"ebrochurefolder=s"  => \$ebrochurefolder,
						"logfile=s"  => \$logfile,
						"gomezzones=s"  => \$gomezzones,
						"emailfrom=s"  => \$email_from,
						"smtp=s"  => \$email_smtp,
						"marketconnectionurl=s"  => \$marketconnectionurl,
						"deletefiles"  => \$deletefiles,
						"configfile=s"  => \$configfile
						)
	or  printusage();
printlog("script started: " .  localtime() . "\n");
openemaillogfile();readconfigfile();
my $efoldpattern = $ebrochurefolder;
$efoldpattern =~ s/MARKET/\*/g;
$efoldpattern =~ s/SUITE/\*Suite/g;
printlog("searching folders in '$efoldpattern'\n");
my @ebrochurefolders = glob($efoldpattern);
printlog("skipped dirs: $skipped, processed dirs: $olddir\n");
printlog("script ended normally: " . localtime() . "\n");
if ($#email_to >= 0)
{
printlog("sending email(s)\n");
closeemaillogfile();
my $msg = MIME::Lite->new(         From     => "$email_from",
         To      => join(",", @email_to),
         Subject =>"Log of the purge of static data from Webe (" . hostname() . ")",
         Type    =>'multipart/mixed'    );
    $msg->attach(        Type => 'TEXT',
		Data => "Please check attachment for purge details on '" . hostname() . "' - folder: $ebrochurefolder.\n",    );
	if (-e "$tempname")
{
$msg->attach(			Type => 'text/plain',
			Path     => "$tempname",
			Filename => "" . hostname() . ".txt",
			Disposition => 'attachment',
		);
}   
$msg->send('smtp',"$email_smtp",Debug=>0);
# send via default
printlog("email(s) sent\n");
}
END{	close($logfh) if ($logfh);}

 

7 thoughts on “36

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>