The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Locking in Unix? nguoidoius UNIX for Dummies Questions & Answers 1 01-23-2008 10:50 PM
ftp account locking morgadoa SUN Solaris 5 10-19-2007 06:47 AM
Locking a file in ksh thanuman UNIX for Dummies Questions & Answers 1 04-27-2005 08:01 AM
File Locking penfold UNIX for Advanced & Expert Users 1 04-11-2005 09:47 AM
System Locking Up mcrawfo4 SCO 1 02-21-2005 01:31 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2008
Registered User
 

Join Date: Apr 2008
Posts: 2
Locking issue

Hi everyone,

I have got a requirement that, i need to check a specific folder,say /test/lock/ for few specific files, say *lock*, whether it has been locked or not.If any one of it is locked than i need to delete that file after a specific time, say after 10 minutes.

I never have worked on such type of program earlier.Can anyone please help me to create a program like this?

Thanks in advance.

Regards
Susant
Reply With Quote
Forum Sponsor
  #2  
Old 04-11-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Code:
dir=/test
[[ -f  $dir/lock ]] && sleep 600  && rm -f ./tmp/lock
If the file /test/lock exists, sleep for 600 seconds then delete the file.
Reply With Quote
  #3  
Old 04-11-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
Just to point out the obvious, you mean "rm -f $dir/lock" at the end.
Reply With Quote
  #4  
Old 04-13-2008
Registered User
 

Join Date: Apr 2008
Posts: 2
Thnnx sa lot for quick reply

Thnnx sa lot for quick reply

Regards
Susant
Reply With Quote
  #5  
Old 09-30-2008
Registered User
 

Join Date: Oct 2006
Posts: 30
Hi Jim,

I have a similar requirement which is basically to detect whether a file ie being locked before I can go and modify it. Is there any possible and simple way that I can check that the file is not being locked by another process. thanks a lot.

Harby.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0