sleep and try later if the file is being used

sleep and try later if the file is being used

Post by Ronnie Your » Thu, 16 May 2002 04:49:59



Hi,

Heres the scenario

There are 3 servers A,B and C

Every day night at 10:00 PM a file is created on server A and copied
over to server B. This is a Huge file and it takes approximately 1/2
hour to copy it over. Sometimes they start the process later if the work
has not completed till then.

I want to write and schedule a shell script which copies this file from
server B to server C only after it has been completely copied over to
server B from server A. If its in use or being copied over my script
should wait for 2 minutes before trying again and it should keep on
trying for 1 hour. If it succeeds it should copy the file over otherwise
it should exit and send an email informing this.

Please Please Suggest. I am a newbee to Unix .

Thanks

Ronnie

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

 
 
 

sleep and try later if the file is being used

Post by Ronnie Your » Thu, 16 May 2002 07:17:14



Still waiting...

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

 
 
 

sleep and try later if the file is being used

Post by Bill Marc » Thu, 16 May 2002 09:15:16


On Tue, 14 May 2002 19:49:59 +0000 (UTC),

Quote:>Hi,

>Heres the scenario

>There are 3 servers A,B and C

>Every day night at 10:00 PM a file is created on server A and copied
>over to server B. This is a Huge file and it takes approximately 1/2
>hour to copy it over. Sometimes they start the process later if the work
>has not completed till then.

A similar question was answered earlier today.  You can transfer the file
from A to B and then rename it, or transfer a second dummy file, so that
if file 2 exists on server B, you know that file 1 has been copied.
Quote:>I want to write and schedule a shell script which copies this file from
>server B to server C only after it has been completely copied over to
>server B from server A. If its in use or being copied over my script
>should wait for 2 minutes before trying again and it should keep on
>trying for 1 hour. If it succeeds it should copy the file over otherwise
>it should exit and send an email informing this.

>Please Please Suggest. I am a newbee to Unix .

>Thanks

>Ronnie

 
 
 

sleep and try later if the file is being used

Post by Bruce Barnet » Thu, 16 May 2002 09:43:08



> I want to write and schedule a shell script which copies this file from
> server B to server C only after it has been completely copied over to
> server B from server A. If its in use or being copied over my script
> should wait for 2 minutes before trying again and it should keep on
> trying for 1 hour. If it succeeds it should copy the file over otherwise
> it should exit and send an email informing this.

When A finished copying the file, have A create another file on server B

On B, wait for that marker file to be created. When it is, delete it and copy
the first file from B onto C.

--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.

 
 
 

sleep and try later if the file is being used

Post by Ronnie Your » Fri, 17 May 2002 03:13:02





> > I want to write and schedule a shell script which copies this file from
> > server B to server C only after it has been completely copied over to
> > server B from server A. If its in use or being copied over my script
> > should wait for 2 minutes before trying again and it should keep on
> > trying for 1 hour. If it succeeds it should copy the file over otherwise
> > it should exit and send an email informing this.

> When A finished copying the file, have A create another file on server B

> On B, wait for that marker file to be created. When it is, delete it and copy
> the first file from B onto C.

It can be easily done if somehow there is a way to know if the file is
being written into or is locked.
If yes then try later if no then copy.

The only problem is that I dont know how to find out if the file is in
the process of being created.

Thanks

--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

 
 
 

sleep and try later if the file is being used

Post by Tinti » Thu, 16 May 2002 20:32:38





> Still waiting...

To learn how Usenet works?
 
 
 

sleep and try later if the file is being used

Post by a.. » Sat, 18 May 2002 04:54:04


  You could check the file size of the written file every 2 min, and
assume that writing is done if it stays the same size for 3 sucessive
samples.  You could also grep the output of 'ps' to look for the
disappearance of the writing process, and do the copy if the file
has a timestamp of 10pm or so.  If you have 'lsof' on your system, it
lists open files, and the program that opened them.  Depending on the
mechanism used to transfer the file, netstat might be useful, as it
shows what network connections are present.  An ftp session would go
away when the transfer was finished, so you could watch for that.

: Hi,

: Heres the scenario

: There are 3 servers A,B and C

: Every day night at 10:00 PM a file is created on server A and copied
: over to server B. This is a Huge file and it takes approximately 1/2
: hour to copy it over. Sometimes they start the process later if the work
: has not completed till then.

: I want to write and schedule a shell script which copies this file from
: server B to server C only after it has been completely copied over to
: server B from server A. If its in use or being copied over my script
: should wait for 2 minutes before trying again and it should keep on

 
 
 

1. This clone thing...am I stupid, or am I right?


says...

I admire your passion, Chris..

The only issues which have kept myself from looking seriously at Linux
would be:

* It's Unix and the learning curve to start getting productive strikes me
as probably very steep

* It doesn't support plug-and-play.  If your hardware doesn't have Linux
drivers, it don't play..

* Not nearly the amount of developers out there doing stuff for Linux as
there are for Wintel.  Can I get MS Office for Linux?  Can I get
Photoshop for Linux?  Can I get QuarkXpress for Linux? etc.. a big turn
off for me.

--
Reuben King
Email: "reuben at texas dot net" (in plain english to foil spam-bots.
grrr!)

2. How to copy from/to user space

3. How determine version of libc?

4. I am with the following error, when i am running lilo...

5. linux and Windows 95

6. Am I touchy? Or am I right?

7. network load

8. Am I seeing IPv5, or am I hallucinating?

9. I am buying an Ultra 5 but am lost in part numbers ....

10. I am in text mode, what browser am I running....

11. I am si**y am I?

12. How to generate the map file when I am using CC