Hello.

I am currently in the process of writing a tiny script to ftp files over to an NT box from one of our unix servers.
#!/usr/bin/perl -w use strict; use Net::FTP; use Getopt::Long; my %opt = (); GetOptions( \%opt, "usr=s", "pwd=s", ); chdir("/home/export/data/"); @files = reverse ( map { split (/\s+/))[8]; } `ls -lrt Open_ +Trade_Summary*`); foreach my $file (@files[0..3]) { check_age($files); } sub check_age{ my $file = shift; ( (if -M $file) < .5 ) { print "$file is current - ok to send\n"; send_file($file); } else { print "No current data available\n"; } sub send_file{ my $file = shift; my $ftp = Net::FTP->new("ntbox01.host.org"); $ftp->login($opt{usr}, $opt{pwd}); $ftp->cwd($remDir); $ftp->put($file); $ftp->exit; }
This is fine. I can cron this and have it check for files whenever. But what I would really like to do is put some sort of loop in the script, that checks say, every 10 minutes, for new files. I can tell it what exact file to look for, but need some kind of "Trigger" functionality to kick off the script...Anyone have any ideas / follow me at all?

Thanks as always,

Azatoth a.k.a Captain Whiplash

Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?

In reply to Using Trigger Files by azatoth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.