BrianAtWork
Programmer
Hello All,
I have a korn shell script that I use on an AIX machine to notify me once a group of files have arrived on the machine.
The script will run and check for the files every 10 minutes - during the check to see if the files are present, there is also a check to see if the file is in use or not - in other words, I don't want to count the file as being "present" if the file is not completely there yet.
Right now, I use the "fuser" command to tell whether a file is in use, but it is pretty slow, and there are over 200 files that need checking.
I use it like this:
and then check the $INUSE variable for that file. The $INUSE variable will contain any process ids that are using the file. If the $INUSE variable is empty then I know the file isn't being used (hopefully).
Does anyone have a better idea of how to make sure the file is not being written to? I could do an "ls -l" to get the filesize, then check it again a couple of seconds later to see if the size changed, but then I am putting loops inside of loops...
Any ideas would be appreciated!
Thanks in advance!
Brian
I have a korn shell script that I use on an AIX machine to notify me once a group of files have arrived on the machine.
The script will run and check for the files every 10 minutes - during the check to see if the files are present, there is also a check to see if the file is in use or not - in other words, I don't want to count the file as being "present" if the file is not completely there yet.
Right now, I use the "fuser" command to tell whether a file is in use, but it is pretty slow, and there are over 200 files that need checking.
I use it like this:
Code:
INUSE=$(fuser $File 2>/dev/null | cut -d: -f2)
Does anyone have a better idea of how to make sure the file is not being written to? I could do an "ls -l" to get the filesize, then check it again a couple of seconds later to see if the size changed, but then I am putting loops inside of loops...
Any ideas would be appreciated!
Thanks in advance!
Brian