- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Last time an executable file was run
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
Discussions
Discussions
Forums
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
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-23-2006 09:55 AM
тАО12-23-2006 09:55 AM
I'm wondering if there is a way to list files and show the last time a file was run. Not the last time it was accessed for edit, but the last time it was executed. This would be very useful for situation where I've been developing and have older versions of a script in the same directory, and want to be sure which ones are actually executing and being called, etc. Best Regards, Gil
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2006 11:52 AM
тАО12-23-2006 11:52 AM
SolutionThe 'atime' (last access timestamp) will be updated any time a file is read or executed. No "last execution" time is available.
For what it's worth, for non-root users to execute a file that requires interpretation, as for instance as a shell or Perl script, the user must also have read-access to be able to execute it.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-25-2006 07:45 PM
тАО12-25-2006 07:45 PM
Re: Last time an executable file was run
you can add in your script this line to know the date and time of each execution :
touch /tmp/$(basename ${0})_$(date +%y%m%d)_$(date +%H%M).log
Best regards
Joel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-25-2006 09:48 PM
тАО12-25-2006 09:48 PM
Re: Last time an executable file was run
It is not possible to get the time when a
file last executed.
U can log the execution time by adding few lines
in the executable if it is a text file as suggested by Joel,
Add these lines to the script
# Start of script
echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" > /tmp/some_logfile
ur script
# End of script
OR if the file is binary then call this file
from a script as follows
# Start of script
echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" > /tmp/some_logfile
# End of Script
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-25-2006 09:55 PM
тАО12-25-2006 09:55 PM
Re: Last time an executable file was run
Pl. read
echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" >> /tmp/some_logfile
instead of
echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" > /tmp/some_logfile
so that the file /tmp/some_logfile will not get
overwritten
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2007 11:21 AM
тАО01-02-2007 11:21 AM
Re: Last time an executable file was run
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-02-2007 12:14 PM
тАО01-02-2007 12:14 PM
Re: Last time an executable file was run
While it may seem to be an oversight not knowing when a file was executed, that information by itself is not very complete from a security point of view. The administrator or audtior would need to know what user executed the file, what tool was used to start exscution (ie, shell command, script, another program, cron, etc) and all the parameters given to the program through the command line and/or a configuration file.
Proper management of executables requires the use of source code control and version numbers in every production executable. The what command can report on version information and detailed auditing techniques might include logging the what string prior to execution.
Bill Hassell, sysadmin