- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "find" to know if a file change in less than 1 hou...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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
12-14-2006 09:30 PM
12-14-2006 09:30 PM
I need to know if a file of log is changing in less than 1 hour.
I found that with command "find file -mtime n " you have to know if a file change in n days. ¿another command o parameter for hours?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2006 09:33 PM
12-14-2006 09:33 PM
Re: "find" to know if a file change in less than 1 hour.
temp file solution in:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1037903
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
So far you have not awarded any points !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2006 12:09 AM
12-15-2006 12:09 AM
Re: "find" to know if a file change in less than 1 hour.
This starts the search at the root directory and looks for all files which were modified less than 1 day (24 hours) ago.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2006 12:18 AM
12-15-2006 12:18 AM
Re: "find" to know if a file change in less than 1 hour.
thanks.-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2006 12:28 AM
12-15-2006 12:28 AM
Solutionthe forum provides faster and more answers, when its previous work was rewarded by points by a question posting user...
Hint to your current question:
- create a stamp file via 'touch' having the 1-hour-back-timestamp
- use find ... -newer stampfile ...
The man-pages will give additional help for both commands!
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2006 12:34 AM
12-15-2006 12:34 AM
Re: "find" to know if a file change in less than 1 hour.
# touch -m -t 200612151300 /var/tmp/first
# touch -m -t 200612151359 /var/tmp/last
# find . -type f \( -newer /var/tmp/first -a ! -newer /var/tmp/last \) -print
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2006 09:33 PM
12-17-2006 09:33 PM
Re: "find" to know if a file change in less than 1 hour.
on line perl:
# To have the list of the file *.txt changed from 1 hours ago to now:
perl -e 'while (<*.txt>) { print "$_\n" if 1/24 > -M }'
to use this go in the directory where your file is and probably chnage .txt as .log.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2006 09:40 PM
12-17-2006 09:40 PM
Re: "find" to know if a file change in less than 1 hour.
I have problems with following:
# touch -m -t 200612151300 /var/tmp/first
# touch -m -t 200612151359 /var/tmp/last
# find . -type f \( -newer /var/tmp/first -a ! -newer /var/tmp/last \) -print
Sometimes "find" return a file that is always changing and sometimes not return it and it should appear.
Thanks and regards.-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2006 11:47 PM
12-17-2006 11:47 PM
Re: "find" to know if a file change in less than 1 hour.
sorry to see you did not read the solution to exactly your problem, as given in my first link.
It specifies the temp file command and the find.
Remember that find command modifies some timestamps itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2006 11:56 PM
12-17-2006 11:56 PM
Re: "find" to know if a file change in less than 1 hour.
> Sometimes "find" return a file that is always changing and sometimes not return it and it should appear.
I would expect this behavior when you use Robert's solution. There is nothing wrong with the solution.
If a file is actively being updated, then its metadata ('mtime', etc.) will periodically be updated. Hence, in the code posted by Robert, a file may fall outside of the scope you defined.
Unix does not maintain a file creation timestamp. Its modification ('mtime') is only equivalent to its creation timestamp when is is first opened for writing, and thus coincidently represents a creation marker.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2006 12:17 AM
12-18-2006 12:17 AM
Re: "find" to know if a file change in less than 1 hour.
> Remember that find command modifies some timestamps itself.
To be clear, 'find' will only modify the *access* timestampe ('atime') of *directories* as it traverses them. For files in a directory to be examined ('stat()' in order to determine their modification, access timestamp, size, etc.) the directory must be read and hence the directory's last access time ('atime') will be changed.
The 'find' solution using '-newer' references the 'mtime' not the 'atime' of a file. Moreover, the solution shown *limited* results to files by using the '-type f' argument to the 'find'.
The manpages for 'find' will offer additional information, too.
Regards!
...JRF...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2006 12:30 AM
12-18-2006 12:30 AM
Re: "find" to know if a file change in less than 1 hour.
I resolved it adding one minute to initial time.
thanks.-