current locks on a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users current locks on a file
# 1  
Old 02-12-2009
current locks on a file

I want to know all the locks on a file - read, write etc acquired by various processes. Is there any way to know ?
# 2  
Old 02-12-2009
One somewhat general way - try to acquire an exclusive lock on the file. If it fails, the file is locked by someone else. If you succeed be sure to release the lock.

Not all systems support mandatory locking. Which seems to be what you are implying.
Whart OS?
# 3  
Old 02-12-2009
A good starting place is lsof if it is supported by your particular flavor of Unix.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Passwd -f locks out login

hello; I have inherited a SunOS sjcorpftp 5.10 Generic_118855-36 i86pc i386 i86pc whenever someone needs a new password, I change it via "passwd username" then "passwd -f username" so they can change their password on my only sun sparc 5.9 you can "accessed denied" when you... (0 Replies)
Discussion started by: ikeleong
0 Replies

2. Shell Programming and Scripting

How to avoid locks while loading database through UNIX script.?

Hi, I have the following requirement: I have load_cdr as main scriptwhich loads all the file records into vertica database through unix script. But there are two files which try to update same table..n thats y my script is getting failed... Can any1 give me some logic how to over come this... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

3. Programming

help with write-read locks inter-process

I need help!Many Thanks! Now,I try to manage the shared memory inter-process . Inevitably,I have to deal with the synchronous. I know the pthread_rwlock in posix,and I compile ,then run successfully in Red Hat Enterprise 4. I have a doubt about whether the Posix supports the system such as... (1 Reply)
Discussion started by: weizh
1 Replies

4. AIX

password locks after user killed

We are finding sometimes after a user process has been killed, when the user tries to reconnect, he gets the message that there has been too many attempts and his password is locked. Has anyone see this? AIX 5.3 tl9 sp3 thanks (0 Replies)
Discussion started by: MizzGail
0 Replies

5. Linux

Whats for: /etc/locks directory?

Hi there! Can someone please tell me what is for the directory /etc/locks and provide me with an example. I certainly don't understand it very well. Any help will be much appreciated! (1 Reply)
Discussion started by: agasamapetilon
1 Replies

6. HP-UX

File Locks

Hi, How to list the files which are not locked? I want to read the files that are not locked by other user only. can we do it using ls option? (5 Replies)
Discussion started by: vijaykrc
5 Replies

7. UNIX for Advanced & Expert Users

SCP / SFTP successful but locks out target account

Hi, We have an interesting problem with F-Secure SSH (v 3.1.0) running on HP-UX. It seems that when scp or sftp commands are issued they are successful but it counts as a 'strike' against the target user locking the account out after 3 attempts. When the user is re-enabled in SAM - it reports... (4 Replies)
Discussion started by: b0bbins
4 Replies

8. Solaris

Checking/ Releasing File Locks in Solaris

Hi, One of my prod jobs using Ab Initio (which is Solaris Based) returned this error: ========= Error from Reformat_3.000 on f7j21-01.xxxx3.com ========= Failed opening file for flow: Resource temporarily unavailable Flow = "Flow_11.000" connected to output port "out0" of "Reformat_3.000"... (0 Replies)
Discussion started by: teenu18
0 Replies

9. Programming

Read/write locks within and between processes. Can you help?

I have an application that is multithreaded and concurrent. Multiple instances of the application must run at the same time. Each thread in each process accesses shared resources. For this purpose I've employed Butenhof's read-write locks. Inter-process locking is based on fcntl. For example,... (3 Replies)
Discussion started by: adamb
3 Replies

10. UNIX for Dummies Questions & Answers

"File in use" - how to identify locks on this file and release them?

At times we see the "file in use" when we run RCS (revision conrol system" on this file. Most of time, we do not see this message. How do we identify the locks on this file and how do we release those locks? I can imagine it happens when there are some processes running on this file. THe... (1 Reply)
Discussion started by: vadimsf
1 Replies
Login or Register to Ask a Question