- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Question about "piped find" behaviour: snapshot or...
Operating System - HP-UX
1753559
Members
6170
Online
108796
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 10:12 PM
тАО06-06-2004 10:12 PM
Question about "piped find" behaviour: snapshot or buffered?
Hello colleagues,
in my system there's a script which processes the files contained in a directory (there's a subtree under this directory); on this directory there're a lot of files; my script launches a "find $dir" command to have all the files in the $dir subtree; moreover there're other processes which create new files under $dir.
Therefore when the script starts in $dir there're (for instance) 50.000 files, after some while there're 55.000 file ....
My question is:
does the "find" make a snapshot of the $dir subtree content or it searches a set of files then searches again?
please note that the find output is piped with a command which processes the files ... i.e.
"find $dir | while read file
do
... processes $file
done"
if to process the $file the script need 4 sec.and in this meanwhile under the $dir 2 new files are created will the script end sometimes?
sorry if I wasn't clear enough
thanks
Enrico
in my system there's a script which processes the files contained in a directory (there's a subtree under this directory); on this directory there're a lot of files; my script launches a "find $dir" command to have all the files in the $dir subtree; moreover there're other processes which create new files under $dir.
Therefore when the script starts in $dir there're (for instance) 50.000 files, after some while there're 55.000 file ....
My question is:
does the "find" make a snapshot of the $dir subtree content or it searches a set of files then searches again?
please note that the find output is piped with a command which processes the files ... i.e.
"find $dir | while read file
do
... processes $file
done"
if to process the $file the script need 4 sec.and in this meanwhile under the $dir 2 new files are created will the script end sometimes?
sorry if I wasn't clear enough
thanks
Enrico
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 10:27 PM
тАО06-06-2004 10:27 PM
Re: Question about "piped find" behaviour: snapshot or buffered?
Hi,
find(1) uses the depth first approach. It travesses the directory first and then searches the parents. The files and directories which will be processed by find depends on the time when it does an opendir(). Files and directories added after the opendir call are not considered for the find operation.
manish
find(1) uses the depth first approach. It travesses the directory first and then searches the parents. The files and directories which will be processed by find depends on the time when it does an opendir(). Files and directories added after the opendir call are not considered for the find operation.
manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 10:34 PM
тАО06-06-2004 10:34 PM
Re: Question about "piped find" behaviour: snapshot or buffered?
ok but my question was a bit different:
the output of the find is piped to a command ... does the find waits for the command completion to complete the "navigation" across the subtree or the subtree is "frozen", a snapshot is taken then the output is produced?
the output of the find is piped to a command ... does the find waits for the command completion to complete the "navigation" across the subtree or the subtree is "frozen", a snapshot is taken then the output is produced?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2004 11:13 PM
тАО06-06-2004 11:13 PM
Re: Question about "piped find" behaviour: snapshot or buffered?
Hi,
It takes a snapshot at the time when it opens the directory to read its content. If a file is created after the snapshot is taken it wont be considered by find.
As far as pipe is concerned find just dumps data in the pipe and if pipe is full then find waits to write to it. If the find output data is less than the pipe buffer find is not affected at all. If find is blocked on writing the data to pipe and during that time if files are created in directory which it has not yet opened for reading then those files will be considered by find once it writes data to buffer and continues processing.
HTH
manish
It takes a snapshot at the time when it opens the directory to read its content. If a file is created after the snapshot is taken it wont be considered by find.
As far as pipe is concerned find just dumps data in the pipe and if pipe is full then find waits to write to it. If the find output data is less than the pipe buffer find is not affected at all. If find is blocked on writing the data to pipe and during that time if files are created in directory which it has not yet opened for reading then those files will be considered by find once it writes data to buffer and continues processing.
HTH
manish
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP