Re: How to avoid writing files that is used by other programs?

2004-08-06 Thread Gunnar Hjalmarsson
Shu Hung wrote:
I am writing a script to relocate some tar files in a folder.
Since those tar files are scheduled to be written daily, I want to
make sure I'm not moving any files which are being written by other
programs...
How can I do so?
You can lock them.
perldoc -f flock
perldoc -q "lock a file"
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: How to avoid writing files that is used by other programs?

2004-08-06 Thread NYIMI Jose \(BMB\)


> -Original Message-
> From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 06, 2004 10:49 AM
> To: [EMAIL PROTECTED]
> Subject: Re: How to avoid writing files that is used by other 
> programs?
> 
> 
> Shu Hung wrote:
> > I am writing a script to relocate some tar files in a folder.
> > 
> > Since those tar files are scheduled to be written daily, I want to 
> > make sure I'm not moving any files which are being written by other 
> > programs...
> > 
> > How can I do so?
> 
> You can lock them.
> 
>  perldoc -f flock
>  perldoc -q "lock a file"
> 

I have a question,
It seems that (from original post) there are 2 programs there:
Program1: writing the tar files
Program2: trying to relocate tar files created by program1

My understanding is that the "lock" should be done by the program1 to avoid
program2 relocate files untill it (program1) finishs writting them.

If the program1 is not under your control, how to use the "lock" solution you 
suggested ?

Thanks,

José.


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: How to avoid writing files that is used by other programs?

2004-08-06 Thread Gunnar Hjalmarsson
Nyimi Jose ) wrote:
Gunnar Hjalmarsson wrote:
Shu Hung wrote:
I am writing a script to relocate some tar files in a folder.
Since those tar files are scheduled to be written daily, I want
to make sure I'm not moving any files which are being written
by other programs...
How can I do so?
You can lock them.
perldoc -f flock
perldoc -q "lock a file"
It seems that (from original post) there are 2 programs there:
Program1: writing the tar files
Program2: trying to relocate tar files created by program1
My understanding is that the "lock" should be done by the program1
to avoid program2 relocate files untill it (program1) finishs
writting them.
If the program1 is not under your control, how to use the "lock"
solution you suggested ?
You can't. Locking must be done by the "other programs" (which I
assumed the OP is able to modify...).
Thanks for pointing it out.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]