<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Last time an executable file was run in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917269#M764360</link>
    <description>Hi Gilbert,&lt;BR /&gt;&lt;BR /&gt;It is not possible to get the time when a&lt;BR /&gt;file last executed.&lt;BR /&gt;&lt;BR /&gt;U can log the execution time by adding few lines&lt;BR /&gt;in the executable if it is a text file as suggested by Joel,&lt;BR /&gt;&lt;BR /&gt;Add these lines to the script&lt;BR /&gt;&lt;BR /&gt;# Start of script&lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;ur script&lt;BR /&gt;&lt;BR /&gt;# End of script&lt;BR /&gt;&lt;BR /&gt;OR if the file is binary then call this file &lt;BR /&gt;from a script as follows&lt;BR /&gt;&lt;BR /&gt;# Start of script&lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;&lt;NAME of="" executable=""&gt; with arguments&lt;BR /&gt;&lt;BR /&gt;# End of Script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Santosh&lt;/NAME&gt;</description>
    <pubDate>Tue, 26 Dec 2006 05:48:10 GMT</pubDate>
    <dc:creator>SANTOSH S. MHASKAR</dc:creator>
    <dc:date>2006-12-26T05:48:10Z</dc:date>
    <item>
      <title>Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917266#M764357</link>
      <description>Hi,&lt;BR /&gt;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</description>
      <pubDate>Sat, 23 Dec 2006 17:55:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917266#M764357</guid>
      <dc:creator>Gilbert Standen_1</dc:creator>
      <dc:date>2006-12-23T17:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917267#M764358</link>
      <description>Hi Gilbert:&lt;BR /&gt;&lt;BR /&gt;The 'atime' (last access timestamp) will be updated any time a file is read or executed.  No "last execution" time is available.  &lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sat, 23 Dec 2006 19:52:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917267#M764358</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-23T19:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917268#M764359</link>
      <description>Hi Gilbert,&lt;BR /&gt;you can add in your script this line to know the date and time of each execution :&lt;BR /&gt;touch /tmp/$(basename ${0})_$(date +%y%m%d)_$(date +%H%M).log&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Joel</description>
      <pubDate>Tue, 26 Dec 2006 03:45:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917268#M764359</guid>
      <dc:creator>Joel Girot</dc:creator>
      <dc:date>2006-12-26T03:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917269#M764360</link>
      <description>Hi Gilbert,&lt;BR /&gt;&lt;BR /&gt;It is not possible to get the time when a&lt;BR /&gt;file last executed.&lt;BR /&gt;&lt;BR /&gt;U can log the execution time by adding few lines&lt;BR /&gt;in the executable if it is a text file as suggested by Joel,&lt;BR /&gt;&lt;BR /&gt;Add these lines to the script&lt;BR /&gt;&lt;BR /&gt;# Start of script&lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;ur script&lt;BR /&gt;&lt;BR /&gt;# End of script&lt;BR /&gt;&lt;BR /&gt;OR if the file is binary then call this file &lt;BR /&gt;from a script as follows&lt;BR /&gt;&lt;BR /&gt;# Start of script&lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;&lt;NAME of="" executable=""&gt; with arguments&lt;BR /&gt;&lt;BR /&gt;# End of Script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Santosh&lt;/NAME&gt;</description>
      <pubDate>Tue, 26 Dec 2006 05:48:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917269#M764360</guid>
      <dc:creator>SANTOSH S. MHASKAR</dc:creator>
      <dc:date>2006-12-26T05:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917270#M764361</link>
      <description>Sorry, a small typing mistake&lt;BR /&gt;&lt;BR /&gt;Pl. read &lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt;&amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;instead of &lt;BR /&gt;&lt;BR /&gt;echo "`dirname $0`/`basename $0` executed at time `date` by user `id -un`" &amp;gt; /tmp/some_logfile&lt;BR /&gt;&lt;BR /&gt;so that the file /tmp/some_logfile will not get&lt;BR /&gt;overwritten&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Tue, 26 Dec 2006 05:55:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917270#M764361</guid>
      <dc:creator>SANTOSH S. MHASKAR</dc:creator>
      <dc:date>2006-12-26T05:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917271#M764362</link>
      <description>Excellent insights all.  When we say "last time a file was read" (atime) what are we talking about?  Doing a "cat" or a "more" -- that is not a "read" is it?  If I vi a file and save it without changing the file (q!) is that a read?  It is mentioned in one post that whenever a file is "executed or read"...so "atime" would tell you only that it was executed OR it was read, but would not allow you to know which event had occurred, whereas the method of embedding some code would tell you that information.  It surprises me that the OS does not track this, because you would think from a security standpoint an admin would want a way to investigate when and by who an executable was last run.  Anyway, I am very grateful for the excellent replies to my post!</description>
      <pubDate>Tue, 02 Jan 2007 19:21:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917271#M764362</guid>
      <dc:creator>Gilbert Standen_1</dc:creator>
      <dc:date>2007-01-02T19:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Last time an executable file was run</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917272#M764363</link>
      <description>There are exactly 3 timestamps for all files and directories in Unix. atime means access time so reading a file is accessing a file regardless of whether what tool was used to read the file (vi, kernel scheduler, cron, etc). The access time always changes when the file is opened regardless of what else is done with the file. Execution is Unix is the process of reading the file into memory (or executing an interpreter to execute a script). There is no timestamp for this. If a change is made to the file, then the modification time is also changed. The other time stamp has to do with inode changes which means ownership and permissions.&lt;BR /&gt; &lt;BR /&gt;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.&lt;BR /&gt; &lt;BR /&gt;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.</description>
      <pubDate>Tue, 02 Jan 2007 20:14:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/last-time-an-executable-file-was-run/m-p/3917272#M764363</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2007-01-02T20:14:57Z</dc:date>
    </item>
  </channel>
</rss>

