![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| all tcp are CLOSED on SCO Unix on VMWARE | martocapo | SCO | 5 | 03-26-2008 01:58 PM |
| Find out the maximum growing file in a mount | raman1605 | UNIX for Dummies Questions & Answers | 3 | 10-01-2007 09:25 PM |
| .osm file growing | golfs4us | UNIX for Dummies Questions & Answers | 1 | 07-23-2007 11:40 AM |
| how can i check if text file is closed ? | umen | Shell Programming and Scripting | 13 | 01-12-2007 11:40 AM |
| file activity (open/closed) file descriptor info using KORN shell scripting | Gary Dunn | UNIX for Dummies Questions & Answers | 3 | 06-07-2004 02:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to check a file in UNIX is closed or growing?
We have a third party tool in UNIX to kick off a 'file copy' job based on a file existance. If a specific file exists in an UNIX directory, another process should start copy the file into another system for further processing. The issue is, the copy job is starting as soon as the file exists in the directory but the file creation process is still writing records into the file.
How to identify the file is closed before starting the 'file copy' job. We have a UNIX script to check the file size for every 30 seconds and compare the previous and current size, if no difference in size we assume the file is closed. This approach does not work if the file creation process is delayed or slow due to network etc.. Any help is appriciated. Thanks K. Lakshmanan |
|
||||
|
A way I use to find growing log files on an unfamiliar system is: Code:
touch /tmp/test find /path/to/suspect -newer /tmp/test A cheesy way you could do this is: Code:
COUNT=`fuser /path/to/file | wc -c` if [ $COUNT -gt 0 ] then echo file is open fi I am sure there is a better way than this, but I don't know what it would be in shell. |
|
||||
|
We also like to use flag files, like Perderabo said. Just have your copy script #1 copy your data file into the directory and then upon success, touch a flag file. Then have copy script #2 check for the existence of the flag file. If the flag file is there, copy the script. If not, wait n minutes.
You also want to remove the flag file, either at the beginning of script #1 or the end of script #2. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|