GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Has a file been read in the last 30 seconds?
Operating System - HP-UX
1846952
Members
4740
Online
110257
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
Forums
Discussions
Discussions
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
08-05-2002 08:08 AM
08-05-2002 08:08 AM
Hello Forumers,
Is there a way in UNIX to find out if a file has been read in the last 30 seconds? Find -atime seems to only work numbers of days.
TIA, Derek
Is there a way in UNIX to find out if a file has been read in the last 30 seconds? Find -atime seems to only work numbers of days.
TIA, Derek
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2002 08:12 AM
08-05-2002 08:12 AM
Solution
Well you could use find -newer tv1 tv2 filename to do this after creating a reference file with touch. Man find for details.
Plan B: Use the attached Perl script.
fileage.pl -a -s 30 myfile
STAT=${?}
if [ ${STAT} -eq 1 ]
then
echo "File has been accessed in the last 30 seconds"
fi
That should do it for you; fileage.pl -u will give full usage.
Plan B: Use the attached Perl script.
fileage.pl -a -s 30 myfile
STAT=${?}
if [ ${STAT} -eq 1 ]
then
echo "File has been accessed in the last 30 seconds"
fi
That should do it for you; fileage.pl -u will give full usage.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2002 08:45 AM
08-05-2002 08:45 AM
Re: Has a file been read in the last 30 seconds?
Thanks Clay. Your perl program works great. I can even use the -c option to find out how long it's been since a file was created. I did add the -v option so that the result was actually printed.
Thank you, Derek
Thank you, Derek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2002 08:50 AM
08-05-2002 08:50 AM
Re: Has a file been read in the last 30 seconds?
Hi Derek:
I'm glad yoy liked the script BUT you can't use the -c option (or find's -ctime) to determine when a file was created. Actually, you can in a few cases but that is by accident. A file's ctime does NOT mean creation but rather changed (not the same as modified). It means the time since a file was chmod'ed or chown'ed or chgrp'ed ... . Surprisingly, there is no way in UNIX to know when a file was actually created. The inode simply does not carry that data.
Regards, Clay
I'm glad yoy liked the script BUT you can't use the -c option (or find's -ctime) to determine when a file was created. Actually, you can in a few cases but that is by accident. A file's ctime does NOT mean creation but rather changed (not the same as modified). It means the time since a file was chmod'ed or chown'ed or chgrp'ed ... . Surprisingly, there is no way in UNIX to know when a file was actually created. The inode simply does not carry that data.
Regards, Clay
If it ain't broke, I can fix that.
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.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP