<?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: timestamp script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452119#M679909</link>
    <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;THis is one way to do what you seek:&lt;BR /&gt;&lt;BR /&gt;# cat ./watch&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;LOGF=/tmp/mylog&lt;BR /&gt;REFF=/tmp/myref&lt;BR /&gt;touch ${LOGF} ${REFF}&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;    if [ "$LOGF" -nt "${REFF}" ];then&lt;BR /&gt;        echo "${LOGF} has been updated"&lt;BR /&gt;        touch -cmr ${LOGF} ${REFF}&lt;BR /&gt;    fi&lt;BR /&gt;    sleep 30&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...You can play with this concept by running the script in the background and 'touch'ing the LOGF file to update it.&lt;BR /&gt;&lt;BR /&gt;Adjust the script's wleep time to you needs.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
    <pubDate>Thu, 02 Jul 2009 16:34:17 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-07-02T16:34:17Z</dc:date>
    <item>
      <title>timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452118#M679908</link>
      <description>I have written a small script which will monitor for a specific word in a text.log file I need to run this script in such a way that it runs only if text.log is a new file.&lt;BR /&gt;This text.log file keeps updated with the new one and doesnot gets appended.&lt;BR /&gt;So will need a script which will check if the file is new then goes ahead with rest of the action.</description>
      <pubDate>Thu, 02 Jul 2009 16:01:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452118#M679908</guid>
      <dc:creator>sahaj bahra</dc:creator>
      <dc:date>2009-07-02T16:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452119#M679909</link>
      <description>&lt;!--!*#--&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;THis is one way to do what you seek:&lt;BR /&gt;&lt;BR /&gt;# cat ./watch&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;LOGF=/tmp/mylog&lt;BR /&gt;REFF=/tmp/myref&lt;BR /&gt;touch ${LOGF} ${REFF}&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;    if [ "$LOGF" -nt "${REFF}" ];then&lt;BR /&gt;        echo "${LOGF} has been updated"&lt;BR /&gt;        touch -cmr ${LOGF} ${REFF}&lt;BR /&gt;    fi&lt;BR /&gt;    sleep 30&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...You can play with this concept by running the script in the background and 'touch'ing the LOGF file to update it.&lt;BR /&gt;&lt;BR /&gt;Adjust the script's wleep time to you needs.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Jul 2009 16:34:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452119#M679909</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-02T16:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452120#M679910</link>
      <description>Sonal,&lt;BR /&gt;&lt;BR /&gt;James has a good idea.&lt;BR /&gt;&lt;BR /&gt;I have a question though and that is how often is the log file replaced? Is it a known time interval or random interval?&lt;BR /&gt;&lt;BR /&gt;If it is random what is the shortest time?&lt;BR /&gt;&lt;BR /&gt;You want to set your sleep time shorter then the shortest time interval but not so short that it is running all the time. That can hog CPU time.&lt;BR /&gt;&lt;BR /&gt;Is this being run from a terminal (telnet) session or in the background?  If you are running this in the background from a telnet session you may want to add a 'trap' statement (example trap exit 1 2 3 15) in the beginning to stop the script if the telnet session terminates.&lt;BR /&gt;&lt;BR /&gt;-Ken&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Jul 2009 13:28:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452120#M679910</guid>
      <dc:creator>Ken Martin_3</dc:creator>
      <dc:date>2009-07-03T13:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452121#M679911</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Ken: If you are running this in the background from a telnet session you may want to add a 'trap' statement (example trap exit 1 2 3 15) in the beginning to stop the script if the telnet session terminates.&lt;BR /&gt;&lt;BR /&gt;This doesn't matter to the job in the background if it was started with 'nohup'.  In that case, the shell will terminate and any running children will be inherited by the 'init' daemon making 'init' their parent process.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 03 Jul 2009 14:26:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452121#M679911</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-03T14:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452122#M679912</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;find $DATA -depth -type f \( -ctime -1 -o -mtime -1 \) -print &amp;gt; $LIST&lt;BR /&gt;&lt;BR /&gt;That will pick up files that are new.&lt;BR /&gt;&lt;BR /&gt;Then process the LIST and take whatever action you need.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 03 Jul 2009 15:08:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452122#M679912</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-07-03T15:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452123#M679913</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;@ SEP: If you read the OP's description it notes, "I need to run this script in such a way that it runs only if text.log is a new file.".  &lt;BR /&gt;&lt;BR /&gt;The interest is in ONE particular file, not a list of files that have been updated.  The goal is for the monitoring script to be awaken when that file changes; to note that change event; and sleep until another change occurs.  Subsequent changes could be seconds, minutes, hours or days later.  Your suggestion doesn't help that objective.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 03 Jul 2009 16:31:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452123#M679913</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-03T16:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452124#M679914</link>
      <description>&lt;P&gt;&amp;gt;JRF: touch ${LOGF} ${REFF}&lt;BR /&gt;&lt;BR /&gt;That's: touch -r ${LOGF} ${REFF}&lt;/P&gt;</description>
      <pubDate>Sun, 02 Oct 2011 02:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452124#M679914</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-10-02T02:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452126#M679916</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: touch -r ${LOGF} ${REFF}&lt;BR /&gt;&lt;BR /&gt;Yes, good point, Dennis.  I didn't mean to update the timestamp of the ${LOGF} at startup.  Thanks.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 06 Jul 2009 14:06:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452126#M679916</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-06T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: timestamp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452127#M679917</link>
      <description>Thanks Guys</description>
      <pubDate>Sun, 12 Jul 2009 16:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/timestamp-script/m-p/4452127#M679917</guid>
      <dc:creator>sahaj bahra</dc:creator>
      <dc:date>2009-07-12T16:17:13Z</dc:date>
    </item>
  </channel>
</rss>

