Rob, I think you're right. I think the idea would be to have the server name next-to-be-processed append to the file, then the next step call a single separate script (start it if not already running, otherwise simpley "wait") that would lock the "control file", and this script would be the single entry point to the 3rd party software, controlling processes to run only one at a time. My thinking before was to have this be part of every script (last step), but then it got real complicated thinking about queues, random wait times and then checking, double checking, etc.
Sometimes simpler is better. Thanks for the suggestion! -Jeff _______ > I don't think you need to get this complex Jeff. If your > bottleneck were /at/ the end of the processing I would suggest a > queue file as you describe, but not as a means of synchronising > the individual scripts. As its final stage each script would > simply append the details of its final operation to a serial file > and then exit. It would then be the job of a separate process to > look at this file periodically and execute any request which may > have been written. That will effectively serialise your > operations. > > However, since your process may not be able to exit straight > away, what you need, as Stefan says, is a simple dummy file lock. > The following will do the trick > > use strict; > use Fcntl ':flock'; > > open my $que, ">> queue" > or die "Couldn't open lock file: $!"; > > flock $que, LOCK_EX or die "Failed to lock queue: $!"; > do_single_thread_op(); > flock $que, LOCK_UN; > > close $que; > > Fcntl is there solely to add the LOCK_EX and LOCK_UN identifiers. > I've opened the file for append so that the file will be created > if it isn't already there, but will be left untouched if it is. > The 'flock' call to lock exclusively will wait indefinitely until > it succeeds, which means that the process has come to the head of > the queue. It then has sole access to your third-party process > and can use it as it needs to before unlocking the file, when the > next process that it may have been holding up will be granted its > lock and can continue. > > I hope this helps, > > Rob > __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]