Re: program to copy files - problems - unix ksh to java

From: kaeli (tiny_one_at_NOSPAM.comcast.net)
Date: 02/10/04


Date: Tue, 10 Feb 2004 08:08:11 -0600

In article <16990fa4.0402100125.6467a049@posting.google.com>,
pifpafpuf@gmx.de enlightened us with...
>
> Hard to believe on a *NIX machine as the system allows to delete
> files held open by other processes. It may be a possible problem
> if the file is on NFS. In any case it
> sounds like the first process, when finished, deletes the file,
> while the 2nd copy process, started while the first was still
> running, then gets in trouble and messes things up.
>

That's probably it.

> > Program gets called again while an instance is running, so it tries to
> > copy files that are currently being copied.
>
> A solution might be to rename the file locally *before*
> copying. This way the process starting 5 minutes later will
> not pick up the same file again. If this is not an option,
> create an empty file with another extension than the
> big file as a mark that the file is being worked on.
>

That won't help.
The code copies any files in a directory on one machine to a directory
on another. So it will still grab the file. The code would have to move
the file, which is already the problem.

>
> There is no need to solve this task in Java.

I need threading (I think) because right now, the solution is to not run
two instances of the code at the same time. That is not a good solution.
We need code that runs almost continuously, looking in directories and
copying and deleting the files.
(it's a DMZ, in case that helps you see why this needs to be done - it
takes files people uploaded and moves them to a machine inside our
firewall)

So, as far as I see, I need C or Java, and I've not coded C in over a
year. :)

We want a process that runs pretty much all the time. I'm thinking a
program that looks in directories over and over. When it finds a file,
it starts a thread that copies it then deletes it. As part of the
thread, it can put the name of the file in a vector. Any new threads
check that vector before bothering a file...

I dunno, am I way off on that?

-- 
--
~kaeli~
Never say, "Oops!"; always say, "Ah, interesting!" 
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


Relevant Pages

  • Re: program to copy files - problems - unix ksh to java
    ... > copying. ... sounds like the first process, when finished, deletes the file, ... I expected the script to wait for the copy to finish before ... > deleting, but it appears that it is not doing that. ...
    (comp.lang.java.programmer)
  • Re: Destroying a Process in Java
    ... > I am trying to destory a process that I have created in Java: ... > the destroy method does not work and is an abstract method. ... the target (on "unknown" systems, ... The first process will be set up ...
    (comp.lang.java.programmer)
  • Re: why no copy constructor in java?
    ... > Another important difference is that Java doesn't have implicit ... > copying, however, it is easier to correctly implement copying or ... > cloning in c++ than Java. ...
    (comp.lang.java.programmer)
  • Re: why no copy constructor in java?
    ... >> copying, however, it is easier to correctly implement copying or ... The lack of a specific syntax in Java can make you ... But my original thoughts came from the fact that clone is often ... data member in C++. ...
    (comp.lang.java.programmer)
  • Re: Insufficient Memory Error
    ... Java Ad to copy. ... Upon closer inspection it appears that I was copying what ... : was copying the recipe. ... JavaScript to cause this "insufficient memory" error? ...
    (microsoft.public.word.application.errors)