<?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: tail script help .. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610097#M35892</link>
    <description>Deepak: if you put your loop into parentheses and redirect their output to "grep" it should work:&lt;BR /&gt;&lt;BR /&gt;( while :; tail -f $LOG; done ) | grep ...&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
    <pubDate>Sat, 10 Nov 2001 19:47:02 GMT</pubDate>
    <dc:creator>Wodisch</dc:creator>
    <dc:date>2001-11-10T19:47:02Z</dc:date>
    <item>
      <title>tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610083#M35878</link>
      <description>Ok here we go .. &lt;BR /&gt;I have a script that does a&lt;BR /&gt;tail -f progmon.log | grep ERROR &lt;BR /&gt;Tough a remsh. (progmon.log is a log from a 3rd party app). And our surveillance&lt;BR /&gt;center is watching this log 18 hours a day. Now I have a cron job that clears out the log every couple of hours. And what happeneds is that when the log clears the the tail will freeze up.And this kicks them out of the menu driven script. Is there another way to do the tail or clear the log so it does not freeze up?&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Thu, 08 Nov 2001 16:53:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610083#M35878</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-11-08T16:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610084#M35879</link>
      <description>How are you clearing the log?&lt;BR /&gt;&lt;BR /&gt;The thing that first comes to mind to do is:&lt;BR /&gt;&lt;BR /&gt;# cat /dev/null &amp;gt; progmon.log&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# &amp;gt; progmon.log&lt;BR /&gt;&lt;BR /&gt;(Those 2 commands do the same thing).&lt;BR /&gt;&lt;BR /&gt;But since the tail process has the file open, I don't know if you'd regain the disk space when you empty the file like that.</description>
      <pubDate>Thu, 08 Nov 2001 17:00:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610084#M35879</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-11-08T17:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610085#M35880</link>
      <description>&amp;lt;&lt;I have="" a="" cron="" job="" that="" clears="" out="" the="" log="" every="" couple="" of="" hours=""&gt;&amp;gt;&lt;BR /&gt; &lt;BR /&gt;What command are you using for clearing the log??   rm is a no-no , since it deletes the&lt;BR /&gt;reference to the file (inode).&lt;BR /&gt;&lt;BR /&gt; You can use,&lt;BR /&gt;#cp $logfile  $logfile.$$&lt;BR /&gt;#&amp;gt;logfile   &lt;BR /&gt;&lt;BR /&gt;It should work fine.&lt;BR /&gt;&lt;BR /&gt;-raj&lt;/I&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610085#M35880</guid>
      <dc:creator>Roger Baptiste</dc:creator>
      <dc:date>2001-11-08T17:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610086#M35881</link>
      <description>Here is the script that runs of cron:&lt;BR /&gt;cd /var/simp/logs&lt;BR /&gt;for FILE in *.log&lt;BR /&gt;do&lt;BR /&gt;        &amp;gt; $FILE&lt;BR /&gt;#       sleep 2&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:04:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610086#M35881</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-11-08T17:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610087#M35882</link>
      <description>Hi Richard:&lt;BR /&gt;&lt;BR /&gt;If you are clearing the log by removing and recreating the file, then this will certainly fail.  Redirect /dev/null into the log file to clear it.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 08 Nov 2001 17:06:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610087#M35882</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-11-08T17:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610088#M35883</link>
      <description>Hmmmmmm.......&lt;BR /&gt;&lt;BR /&gt;I just did a test that is almost exactly like what you are doing, and doing the '&amp;gt; filename' do screw up the tail.  I don't understand why, but it does.&lt;BR /&gt;&lt;BR /&gt;Now I'll have to think about this.</description>
      <pubDate>Thu, 08 Nov 2001 17:07:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610088#M35883</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-11-08T17:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610089#M35884</link>
      <description>Yes this is a problem with tail -f when logs are cleared down. Why not do something like this...&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;tail -f progmon.log&lt;BR /&gt;sleep 10&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Then change your script which clears the logs to:&lt;BR /&gt;&lt;BR /&gt;cd /var/simp/logs &lt;BR /&gt;for FILE in *.log &lt;BR /&gt;do&lt;BR /&gt;fuser -k $FILE&lt;BR /&gt;&amp;gt; $FILE &lt;BR /&gt;# sleep 2 &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;A bit messy I know, but it should work.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Thu, 08 Nov 2001 17:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610089#M35884</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2001-11-08T17:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610090#M35885</link>
      <description>Hmmmm, interesting thought.... what happens when you cat /dev/null into an open piped file? I have no idea... maybe you should try using "cat /dev/null &amp;gt; ..." in your script in case the "&amp;gt;" is interpreted differently in a script rather than at the shell prompt.&lt;BR /&gt;&lt;BR /&gt;Also, have you though of creating a script that first kills the tail -f, then zeros the logfile, then restarts the tail -f (with nohup and &amp;amp;)?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;James</description>
      <pubDate>Thu, 08 Nov 2001 17:13:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610090#M35885</guid>
      <dc:creator>James Beamish-White</dc:creator>
      <dc:date>2001-11-08T17:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610091#M35886</link>
      <description>&lt;P&gt;Ooops! &lt;BR /&gt;&lt;BR /&gt;Just thought about this a bit more, and this won't work as it will terminate whatever process is writing to the logs. Of course you could still use fuser to determine the processes that have the file open, and then determine which one is the tail -f using ps. &lt;BR /&gt;&lt;BR /&gt;Just goes to show you should think before you open your mouth!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 11:04:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610091#M35886</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2022-07-07T11:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610092#M35887</link>
      <description>OK.  Try this to clear your logfiles.  I think it will work for you.  I have tried it and it does 0 out the log file and it does NOT kill the tail process.  It does take tail a bit (15-30 seconds -- the last time it took about a minute) to come back though.&lt;BR /&gt;&lt;BR /&gt;sed 'd' $FILE &amp;gt; $FILE&lt;BR /&gt;&lt;BR /&gt;The 'd' in the sed command (the single quotes are required) tells it to delete all lines of the file.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Thu, 08 Nov 2001 17:35:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610092#M35887</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2001-11-08T17:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610093#M35888</link>
      <description>Hi Richard:&lt;BR /&gt;&lt;BR /&gt;You remember that stuff about traps. This would be an elegant solution to your problem.&lt;BR /&gt;Suppose that your cron job that copies /dev/null to your log or however you wish to clear the log first sends a signal to the your tail script process(es); then sleeps a bit to allow the processes to respond; and then clears your log. Your tail script processes would then respond by sleeping a bit and then restarting themselves and don't forget to reassert the trap.&lt;BR /&gt;&lt;BR /&gt;I could code this for you but it's the journey that's important.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Thu, 08 Nov 2001 18:06:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610093#M35888</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-11-08T18:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610094#M35889</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;How about running 'tail' in a loop, rather than relying on 'tail -f'?&lt;BR /&gt;&lt;BR /&gt;Maybe something like&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;tail -24 &lt;LOGFILE&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Just replace 24 with the number of lines your screen can display.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Deepak. &lt;BR /&gt;&lt;/LOGFILE&gt;</description>
      <pubDate>Fri, 09 Nov 2001 02:20:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610094#M35889</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2001-11-09T02:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610095#M35890</link>
      <description>Hi Richard,&lt;BR /&gt;&lt;BR /&gt;The GNU tail does this perfectly.  Can be obtained from:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Gnu/textutils-2.0.10" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Gnu/textutils-2.0.10&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Fri, 09 Nov 2001 14:48:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610095#M35890</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-11-09T14:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610096#M35891</link>
      <description>Running tail in a loop (as mentioned in my last post) works fine as long as:&lt;BR /&gt;1. the log file is not 'rm'ed&lt;BR /&gt;2. no more than 24 lines (one screenfull) are written per second.&lt;BR /&gt;&lt;BR /&gt;You could increase the number of lines from 24 to anything you're comfortable with, but with larger values the display tends to be a little jerky.</description>
      <pubDate>Sat, 10 Nov 2001 03:40:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610096#M35891</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2001-11-10T03:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610097#M35892</link>
      <description>Deepak: if you put your loop into parentheses and redirect their output to "grep" it should work:&lt;BR /&gt;&lt;BR /&gt;( while :; tail -f $LOG; done ) | grep ...&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Sat, 10 Nov 2001 19:47:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610097#M35892</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-11-10T19:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610098#M35893</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;Just curious..how did you work around this one?</description>
      <pubDate>Tue, 13 Nov 2001 04:32:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610098#M35893</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2001-11-13T04:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: tail script help ..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610099#M35894</link>
      <description>Hey Deepak and everyone .. &lt;BR /&gt;I am still playing with this .. I have had other issues come up that need to be taken care of. I will assign points and post results when I get a chance. &lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Tue, 13 Nov 2001 15:45:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-script-help/m-p/2610099#M35894</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-11-13T15:45:24Z</dc:date>
    </item>
  </channel>
</rss>

