Hi all, i have this simple script to check if a file has arrive since
the last hour

find2perl tmp -type f -eval '-M $_ < 1/24' -print |perl

but now i would like to check in a remote server, maybe on ftp
session. i have this ftp.pl

perl -w >> ftp.log -MNet::FTP -le'
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek
+, $dayOfYear, $daylightSavings) = localtime();
$year = 1900 + $yearOffset;
$theGMTime = "$hour:$minute:$second, $months[$month] $dayOfMonth,
( $host, $user, $pass, $dir ) = @ARGV;
$ftp = Net::FTP->new($host) or die "$@\n"; #send mail if cannot
connect do not know how to do it
$ftp->login( $user, $pass ) or die $ftp->message;
$ftp->cwd($dir) or die $ftp->message;
for $file ($ftp->ls){
push @files, $file;

for $file (@files) {
print "MDTM with FORMAT = $quesesto\n";
print "Localtime No Format = $localtimenoformat\n";
print "MDTM No Format = $mdtmnoformat\n";
#envia_mail ();
$ftp->quit or die $ftp->message;

sub envia_mail {
print "Content-type: text/html\n\n";

$from= `hostname`;

open(MAIL, "|/usr/sbin/sendmail -t");

## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
print MAIL "This is a test message \n";


print "<html><head><title>$title</title></head>\n<body>\n\n";

## HTML content sent, let use know we sent an email
print "

A message has been sent from $from to $to



'host user pass dir

Still cant't figure out how to check if file is newer that an hour. I
can get this:

MDTM with FORMAT = Fri Aug 21 12:23:15 2009
Localtime No Format = Fri Aug 13 10:17:10 2010
MDTM No Format = 1250871795

But don't know how to get the 'localtime with NO Format' to compare
with the 'MDTM with NO Format'

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupbeginners @
postedAug 17, '10 at 12:38p
activeAug 18, '10 at 12:41p

2 users in discussion

Atropo: 1 post Shlomi Fish: 1 post



site design / logo © 2022 Grokbase