Re: scheduling a perl script

From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 03/06/04


Date: 6 Mar 2004 13:45:38 GMT

mike <s99999999s2003@yahoo.com> wrote in comp.lang.perl.misc:
> hi
>
> i wrote a script that is supposed to check a directory and see if
> there is a file named "test.txt" there and if there is , use ftp to
> transfer the file to another server and then remove the file from the
> directory.
> I had scheduled a job in windows to poll for this directory looking
> for "test.txt" every month on day 8, 9 and 10 and 11, because test.txt
> will arrive anytime during 8,9 and 10. On the 11th, my script will
> poll the directory and if there is still no test.txt, will alert the
> administrator.
>
> How can i implement in perl such that on the 11th, my script will not
> mistake that test.txt is not there while in fact, it has already been
> transfered to another server and removed after transfered?
> I thought of not removing test.txt after transfered but if the file
> arrived on the 8th, then on the 9th i would do another identical
> transfer.

One solution might be to let it do just that. What's a spurious file
transfer or three among friends? On the 11th, delete it to stop the
transfers. If there's nothing to delete, blow the horn.

> I also thought of using a "status" file. Something like
>
> open ( STATUS , "> status.out");
> print STATUS "0";
>
> then if test.txt arrrives, do the transfer, remove the file and update
> STATUS.
> Is this the correct way to do ??

Your question has nothing to do with Perl. The problem would be the same
if you were to implement it in any other language.

A status file is one solution, but you may not need one, even if you
want to avoid extra transfers.

Don't remove the file, move it, to a subdirectory "done" for instance.
Then it won't invite another transfer, but it's still around to show
it's been dealt with. Again, clear the "done" directory every 11th.

Anno



Relevant Pages

  • Advice for moving linux script to MacPerl
    ... in perl that runs on our Linux web server. ... - I told them to download and install MacPerl, ... script that prints the environment variables. ...
    (comp.lang.perl.misc)
  • Perl / Apache on RH9.0 not working.
    ... The server encountered an internal error and was unable to complete your ... Premature end of script headers: ... This is the first time I"ve used Apache 2.0 so I'm not sure if this is an Apache or a Perl issue. ... Configuration Phase Participation: Create Directory Config, ...
    (RedHat)
  • Re: match machine name to user name
    ... :>: query the server from a client for a username based on a machine name. ... :> It reads better if you post inline or at the bottom. ... Is it better to use the script to poll the server or to ...
    (microsoft.public.scripting.vbscript)
  • [Full-Disclosure] PR0V1NG RFP WR0NG
    ... Agree that the presented Perl code has issues, and I agree that it's very ... I've taken a sample perl test script which reads: ... Server: Netscape-Enterprise/4.1 ... I'm a washed out sell out capitalizing on my 10 seconds of fame for writing some crappy advisories and some shitty perl code. ...
    (Full-Disclosure)
  • RE: Perl / Apache on RH9.0 not working.
    ... Perl / Apache on RH9.0 not working. ... The server encountered an internal error and was unable to complete your ... Premature end of script headers: ... Configuration Phase Participation: Create Directory Config, ...
    (RedHat)