Perl's flock and then unlink (IIRC, in perl to delete it) and move to the
next one. That, or if you think you'll get too busy, check for a 'lock'
file, if it doesn't exist, create it, run, then delete your lock file.
On Nov 7, 2010 11:46 PM, "Chap Harrison" <c...@pobox.com> wrote:
>
> On Nov 7, 2010, at 6:47 PM, shawn wilson wrote:
>
>> its Unix, I'd use cron as its probably already running. And do something
>> like: script.pl $(find <path> -type f -print0) Every few seconds.
>
> That looks plenty straightforward enough, except how does one prevent a
race condition wherein cron launches another instance of script.pl before
the first instance has exclusively grabbed responsibility for loading the
newly-arrived files?
>
> Some googling seems to indicate that cron itself does not provide any
mechanism to ensure against spawning multiple concurrent instances of a cron
job. Sorry, I realize that this is not specifically a Perl problem at this
point, so I guess I'll need to research some Unix-y ways of handling this.
>
>
>
>
>
>
>> On Nov 7, 2010 7:17 PM, "Chap Harrison" <c...@pobox.com> wrote:
>>> Hi folks,
>>>
>>> I'm in the thinking stages of creating a table-load utility, which reads
a
>> tab-separated CSV file and inserts or updates rows in a relational table
>> (probably Oracle). I don't think that will be too hard, having used Perl
>> DBI/DBD modules in the past. What's different is that customers will
>> transmit their files to a directory on a Linux server, using an FTP/SFTP
>> client of their choosing, after which my utility needs to "notice" the
>> arrival of the file, and initiate the table updating.
>>>
>>> Are there any Perl facilities, or modules, I should be considering for
>> this? Or is this sort of problem typically solved with something as
>> primitive as a daemon that periodically polls for changes to the
>> directories?
>>>
>>> And - is there perhaps a name for this kind of design? (I mean, other
than
>> "somewhat retarded" ;-) Kind of like "store-and-forward", but different?
>> That would help my googling.
>>>
>>> I do appreciate any follow-up questions or suggestions....
>>>
>>> Chap
>>>
>>>
>>> --
>>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>>> For additional commands, e-mail: beginners-h...@perl.org
>>> http://learn.perl.org/
>>>
>>>
>

Reply via email to