File under use

Hi all,

How to find that a file is under use by another process.

My requirement :

If file (say 1GB) is getting copied to a folder, how to I find that it is a complete file or incomplete.

In order to accomplish my requirement , I would like to know whether the file is under use...

please help.

Thanks,

ravinder

[360 byte] By [ravinder] at [2007-11-26 7:29:46]
# 1
Hi,Have you try grep-ing for the file i.e.ps -eaf | grep filename/cmdname Ferruti
ferruti at 2007-7-6 19:22:40 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2

I have tried it. But, there are two problems with it:

1. When I try to copy the file from another system via ftp, i don't see any process using the file.

2. When I try to copy the file from one folder to another via GUI (say, right click -> copy file and rightclick-> paste file), i don't see any process using the file.

thanks,

ravinder

Message was edited by:

ravinder

ravinder at 2007-7-6 19:22:40 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3
Hmm, have you try checking what's on your /tmp or /var/tmp directories regarding this particular file?
ferruti at 2007-7-6 19:22:40 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4

That issue is generally handled by the applications, not by the OS.

You can ask if a file is currently open by a process with 'fuser', but only user-land processes will appear. If the file is on an NFS server, a client may be acting on it and 'fuser' would not show any indication of that.

Under Solaris 10 you could look for activity on the file (opens, closes, reads, writes), but none of that would tell you if something were about to begin working on the file.

The best way to solve the problem is to have the applications do an explicit handoff via some signalling method (like a file location, name convention, other..).

--

Darren

Darren_Dunham at 2007-7-6 19:22:40 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 5
The best way to solve the problem is to have the applications do anexplicit handoff via some signalling method (like a file location, name convention, other..).How do I do this....?
ravinder at 2007-7-6 19:22:40 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...