A simple and interesting conundrum

A simple and interesting conundrum

Post by abb1 » Wed, 08 May 2002 01:51:45



Well, its interesting to me at least...

I have a couple of large Solaris 7/8 boxen onto which very large files
are written daily.  I've been charged with the task of moving these files
as theyre finished being written to a number of other boxes, running NT,
VMS and Solaris. Moving them isnt the problem, ill probably end up using
scp or rsync.

The problem is that part of the charge is that they are to be moved one at a
time, as they're finished being written. Since they arent being appended
by the application thats writing them (an in-house blob of perl, csh and
python nastiness over which I have zero control) when they're done, I'm
having trouble figuring out the best way to note their finished-ness before
moving them.  I was considering using gnufind's -mmin flag for a fairly
decent amount of granularity in this case, but I'd rather not use something
thats in any way resource intensive if I can at all avoid it.

I'm pretty good with shellscripts (sh,ksh,bash), not very good with perl,
absolutely terrible with C(++), and unfortunately the options for
implementation on these Solaris machines ends right there.

Has anyone else ever come across a similar problem?  Is there some kind of
function or utility under Solaris that I'm missing?

Thanks in advance,

abbie

 
 
 

A simple and interesting conundrum

Post by savares » Wed, 08 May 2002 02:53:45



> Well, its interesting to me at least...
> I have a couple of large Solaris 7/8 boxen onto which very large files
> are written daily.  I've been charged with the task of moving these files
> as theyre finished being written to a number of other boxes, running NT,
> VMS and Solaris. Moving them isnt the problem, ill probably end up using
> scp or rsync.
> The problem is that part of the charge is that they are to be moved one at a
> time, as they're finished being written. Since they arent being appended
> by the application thats writing them (an in-house blob of perl, csh and
> python nastiness over which I have zero control) when they're done, I'm
> having trouble figuring out the best way to note their finished-ness before
> moving them.  I was considering using gnufind's -mmin flag for a fairly
> decent amount of granularity in this case, but I'd rather not use something
> thats in any way resource intensive if I can at all avoid it.
> I'm pretty good with shellscripts (sh,ksh,bash), not very good with perl,
> absolutely terrible with C(++), and unfortunately the options for
> implementation on these Solaris machines ends right there.
> Has anyone else ever come across a similar problem?  Is there some kind of
> function or utility under Solaris that I'm missing?
> Thanks in advance,
> abbie

Well, you can have the application that writes the file move it to another
directory when it is finished. You can then have a script or a cronjob look
for any files in that directory and move them when they find them.

Scott

 
 
 

A simple and interesting conundrum

Post by Alan Gibli » Wed, 08 May 2002 03:05:41


There are a few ways that you can do this.

First, take a look at the process that is writing the files, is there a
way to
make it to the work for you, ie have it tell you when it is done. If so,
you
can then just check for each files completion based on the process.
        If that isn't possible, observe the writing process to see how it
behaves while it works, it may be as simple as checking the modifcation
times
on the file and when it comes up twice at the same time, it is ok to
start the
copy.
        You will be able to use a shell script or perl to accomplish the tasks
easily.
        Since you didn't include all of the information to help more completly
I hope that this helps you along to a solution

        Alan

Quote:> Well, its interesting to me at least...

> I have a couple of large Solaris 7/8 boxen onto which very large files
> are written daily.  I've been charged with the task of moving these files
> as theyre finished being written to a number of other boxes, running NT,
> VMS and Solaris. Moving them isnt the problem, ill probably end up using
> scp or rsync.

> The problem is that part of the charge is that they are to be moved one at a
> time, as they're finished being written. Since they arent being appended
> by the application thats writing them (an in-house blob of perl, csh and
> python nastiness over which I have zero control) when they're done, I'm
> having trouble figuring out the best way to note their finished-ness before
> moving them.  I was considering using gnufind's -mmin flag for a fairly
> decent amount of granularity in this case, but I'd rather not use something
> thats in any way resource intensive if I can at all avoid it.

> I'm pretty good with shellscripts (sh,ksh,bash), not very good with perl,
> absolutely terrible with C(++), and unfortunately the options for
> implementation on these Solaris machines ends right there.

> Has anyone else ever come across a similar problem?  Is there some kind of
> function or utility under Solaris that I'm missing?

> Thanks in advance,

> abbie

--
********\\\\\\\\|////////********
People who are willing to sacrifice
   Freedom for safety deserve neither
      Benjamin Franklin
********////////|\\\\\\\\********

Sr. UNIX Administrator / MIS
Advanced Fibre Communications

 
 
 

A simple and interesting conundrum

Post by Darren Dunha » Wed, 08 May 2002 03:23:19



> scp or rsync.
> The problem is that part of the charge is that they are to be moved one at a
> time, as they're finished being written. Since they arent being appended
> by the application thats writing them (an in-house blob of perl, csh and
> python nastiness over which I have zero control) when they're done, I'm
> having trouble figuring out the best way to note their finished-ness before
> moving them.  I was considering using gnufind's -mmin flag for a fairly
> decent amount of granularity in this case, but I'd rather not use something
> thats in any way resource intensive if I can at all avoid it.

If you have zero knowledge of what this program can do, you're lost.
Since there's no way to tell that the program is *done* with the file.

However, if the program always

Opens a new file for writing,
Writes to it a while.
Closes the file forever

Then you could use 'fuser' or 'lsof' to see which files are no longer
open and move them.

If the program can do something between those two extremes, then you're
going to have to find out about it.

--

Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

 
 
 

A simple and interesting conundrum

Post by Rich Tee » Wed, 08 May 2002 04:59:02



> I have a couple of large Solaris 7/8 boxen onto which very large files
> are written daily.  I've been charged with the task of moving these files
> as theyre finished being written to a number of other boxes, running NT,
> VMS and Solaris. Moving them isnt the problem, ill probably end up using
> scp or rsync.

Why not share the files with NFS and/or Samba?  That way, there's no
need to actually copy them to another machine.

--
Rich Teer

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

 
 
 

A simple and interesting conundrum

Post by -wisegu » Wed, 08 May 2002 06:29:24




Quote:> Well, its interesting to me at least...

> I have a couple of large Solaris 7/8 boxen onto which very large files
> are written daily.  I've been charged with the task of moving these files
> as theyre finished being written to a number of other boxes, running NT,
> VMS and Solaris. Moving them isnt the problem, ill probably end up using
> scp or rsync.

> The problem is that part of the charge is that they are to be moved one
> at a time, as they're finished being written. Since they arent being
> appended by the application thats writing them (an in-house blob of perl,
> csh and python nastiness over which I have zero control) when they're
> done, I'm having trouble figuring out the best way to note their
> finished-ness before moving them.  I was considering using gnufind's
> -mmin flag for a fairly decent amount of granularity in this case, but
> I'd rather not use something thats in any way resource intensive if I can
> at all avoid it.

> I'm pretty good with shellscripts (sh,ksh,bash), not very good with perl,
> absolutely terrible with C(++), and unfortunately the options for
> implementation on these Solaris machines ends right there.

> Has anyone else ever come across a similar problem?  Is there some kind
> of function or utility under Solaris that I'm missing?

> Thanks in advance,

Regardless of anything else, you MUST be able to determine when a file is
done being appended (especially if from multiple sources).  If you cannot
consistently verify this then any other procedure you write will be error
prone.  Maybe have the process doing the writing put an end of file record on
the file when it's done.  You can then scan each file (every few minutes) and
move only files that contain the end of processing flag.

These are basic text files, right?

--
-- Rob Prowel (A.K.A. da wiseguy)
URL:  http://www.prowel.com/

 
 
 

1. Interesting scripting conundrum

I am running a Solaris 2.7 box with a Netscape webserver.  Our design group
uses a standard naming convention to label their graphics (such as
GFXXXXXR.gif), but now we discover that some of these 'net police' software
programs are blocking our site due to the XXX reference.

Who woulda thunk it?

The number of Xs ranges from 5 in a row (XXXXX) to 3 in a row (XXX).

So, now I am trying to come up with a script that will recursively dive
through the www directory and:
1.  rename any filename with XXXXX to ZZZZZ.
2.  open any .htm or .html document and replace all instances of XXXXX with
ZZZZZ.

I suppose the program will have to run once looking for 5 in a row (XXXXX),
then 4, then 3 in order to wipe out every instance.

I am having a heck of a time writing this sucker.
Any help?

Brooke

2. Help: make and archives

3. Interesting Conundrum

4. What about repartitioning ext2 ?

5. Matrox Mystique ands X.

6. Desktop Managers!?!?!?!?

7. Interested in simple off-line news reading package for slow lines?

8. New Redhat 4.0 install, can't log in as root

9. Simple Linux-Win98 networking made - I can probably help you if you are interested

10. interesting, simple question

11. ODT3.0 /u conundrum

12. Conundrum