The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Will the output file be opened and closed several times? koifans Shell Programming and Scripting 7 12-28-2007 03:57 AM
How to check a file in UNIX is closed or growing? kslakshm UNIX for Advanced & Expert Users 6 01-06-2005 08:48 AM
file activity (open/closed) file descriptor info using KORN shell scripting Gary Dunn UNIX for Dummies Questions & Answers 3 06-07-2004 10:54 AM
How to know a new file is in process of creating? It has not been closed. linkjack High Level Programming 2 02-11-2003 10:55 AM
How to check if a unix text file is being accessed? rickylui UNIX for Dummies Questions & Answers 6 08-21-2002 02:35 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-02-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
how can i check if text file is closed ?

Hello all
im trying to make daemon that listen for incoming textiles
and then it will move them to defined directory now the daemon part is ok
but im stack on how to check of file is close and done copied to directory .
so i could process it and move it forward
tnx
Reply With Quote
Forum Sponsor
  #2  
Old 07-02-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
I think you can use write lock (see Blocking file read)
Reply With Quote
  #3  
Old 07-02-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
are there any perl build in function as stat ?

or some other way? with out using fcntl?
Reply With Quote
  #4  
Old 07-02-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
look into 'man fuser' or 'man lsof'
Reply With Quote
  #5  
Old 07-03-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
so what will be the best way to check if file is still being copied?

i dont see any option with using the fuser
Reply With Quote
  #6  
Old 07-03-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
Code:
#!/bin/ksh
in_use=$(fuser -u /path/to/file/filename)
if [ ${#in_use} -gt 0 ] ; then
   echo "file in use"
else
   echo "file not in use"
fi
Reply With Quote
  #7  
Old 07-03-2006
Registered User
 

Join Date: Aug 2005
Posts: 229
fuser -u gives me only the file name as output

on sunos solaris when i do fuser -u myfile.txt
the output is :
myfile.txt:

what is wrong here?
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 11:58 PM.


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