program to copy files - problems - unix ksh to java

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


Date: Mon, 9 Feb 2004 10:33:48 -0600


Hi all,

I've got a shell script (ksh) that does some file copying and deleting.
I'm running into some problems with it that I'm wondering if I can
solve. Since I plan on re-writing it with java (1.4), I figure I might
as well do it right this time.

Here's the drill:
Cron runs this code every 5 minutes.
Program looks on one machine, uses ssh to copy a file to another
machine, changes the filename, the owner and permissions (chmod), and
then deletes the file from the source machine.
Sounds simple enough...

Problems:
Large files (we're talking gigabytes) take more than 5 minutes to copy.
Something is causing the file to be deleted before it has finished
copying. We lose the whole file, as it doesn't show up on either
machine.
Program gets called again while an instance is running, so it tries to
copy files that are currently being copied.

I was going to solve this with the usual .running type fix, but we
really need the program to actually run every 5 minutes (more than one
instance will be needed). If an instance is already copying the file,
the file should just be ignored. The file should not be deleted if the
copy hasn't finished.

Does anyone know of any system stuff I should be looking at for java?
Specifically, Unix Solaris interface so I can tell if a file is in use?
Also, how can I make sure that the copy was finished before deleting the
source? I expected the script to wait for the copy to finish before
deleting, but it appears that it is not doing that. Should I use threads
for this?

Thanks for any ideas, input, etc...

-- 
--
~kaeli~
Bakers trade bread recipes on a knead-to-know basis.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


Relevant Pages

  • Re: program to copy files - problems - unix ksh to java
    ... > I've got a shell script that does some file copying and deleting. ... > then deletes the file from the source machine. ...
    (comp.lang.java.programmer)
  • 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: [kde] Konqueror is very slow!!!
    ... every file in a directory, before moving, copying or deleting it? ... Because it wants to show a progress information. ...
    (KDE)
  • User profiles and C/C++
    ... XP)(creating, copying, deleting and mapping to the other drive). ... Is there any valuable source of information how to do task like that? ...
    (microsoft.public.win32.programmer.kernel)
  • Isass.exe - System Error
    ... I had to restore my registry by copying and deleting ... computer begain to reboot, ...
    (microsoft.public.windowsxp.security_admin)