![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
I think you can use write lock (see Blocking file read)
|
|
#3
|
|||
|
|||
|
are there any perl build in function as stat ?
or some other way? with out using fcntl?
|
|
#4
|
||||
|
||||
|
look into 'man fuser' or 'man lsof'
|
|
#5
|
|||
|
|||
|
so what will be the best way to check if file is still being copied?
i dont see any option with using the fuser |
|
#6
|
|||
|
|||
|
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
|
|
#7
|
|||
|
|||
|
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? |
|||
| Google The UNIX and Linux Forums |