<?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: Simple Unix script (bourne/Korne) Needed! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995831#M125380</link>
    <description>didn't you already post this question:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html" target="_blank"&gt;http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;in any case...&lt;BR /&gt;The following script may need some minor modifications to excape any special characters in the sed statements.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/ksh&lt;BR /&gt;x=1&lt;BR /&gt;while x=1&lt;BR /&gt;do&lt;BR /&gt;cat logfile | grep 07832 Incremental database backup completed successfully.] : Log :  &amp;gt;&amp;gt; newlogfile&lt;BR /&gt;cat logfile | sed 's/07832 Incremental database backup completed successfully.] : Log : //#07832 Incremental database backup completed successfully.] : Log : /g' &amp;gt; logfile2&lt;BR /&gt;mv logfile2 logfile&lt;BR /&gt;sleep 600&lt;BR /&gt;done</description>
    <pubDate>Thu, 12 Jun 2003 12:50:36 GMT</pubDate>
    <dc:creator>John Meissner</dc:creator>
    <dc:date>2003-06-12T12:50:36Z</dc:date>
    <item>
      <title>Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995829#M125378</link>
      <description>All: &lt;BR /&gt;&lt;BR /&gt;I need a simple UNIX script (Bourne/Korne/Tcsh) that someone might have already done or would know how to do with the following requirements: &lt;BR /&gt;&lt;BR /&gt;The script would run every 10 or 15 minutes and look inside a certain application log for the following strings: &lt;BR /&gt;&lt;BR /&gt;2003/06/08 20:08:52 :MGR ,26317:6501 [-07832 Incremental database backup completed successfully.] : Log : &lt;BR /&gt;&lt;BR /&gt;2003/06/08 20:14:13 :MGR ,26317:6501 [-07832 Incremental database backup completed successfully.] : Log : &lt;BR /&gt;&lt;BR /&gt;2003/06/08 20:19:44 :MGR ,26317:6501 [-07832 Incremental database backup completed successfully.] : Log : &lt;BR /&gt;&lt;BR /&gt;I will also attach a sample of the log since the above does not show up on a single line. &lt;BR /&gt;&lt;BR /&gt;The Incremental database backup completed successfully messages show up every 5 or 6 minute intervals as shown above which indicates that there are no problems. &lt;BR /&gt;&lt;BR /&gt;The script will check the log file for the latest [-07832 Incremental database backup completed successfully.] &amp;amp; compare the message date and time time to the current date and time. If no new incremental successful message is in the log within a 10 minute period then it will send an opcmsg (ITO Alert) stating that the incremental backup failed. &lt;BR /&gt;&lt;BR /&gt;I thought a command like this could be used somewhere in the script: &lt;BR /&gt;&lt;BR /&gt;# cat oracle.log-0 | grep "Incremental database backup completed successfully" | tail -1 &lt;BR /&gt;&lt;BR /&gt;2003/06/08 20:19:44 :MGR ,26317:6501 [-07832 Incremental database backup completed successfully.] : Log : &lt;BR /&gt;&lt;BR /&gt;Any help someone could provide would be greatly appreciated as I know there are individuals within the forums here who are very good at scripting. &lt;BR /&gt;&lt;BR /&gt;Look forward to hearing from you. &lt;BR /&gt;&lt;BR /&gt;Thanks...</description>
      <pubDate>Thu, 12 Jun 2003 12:39:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995829#M125378</guid>
      <dc:creator>Shaun Aldrich_1</dc:creator>
      <dc:date>2003-06-12T12:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995830#M125379</link>
      <description>Hi Shaun:&lt;BR /&gt;&lt;BR /&gt;Is this a duplicated question or none of the answers given yesterday worked for you?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Thx,&lt;BR /&gt;&lt;BR /&gt;Dario</description>
      <pubDate>Thu, 12 Jun 2003 12:44:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995830#M125379</guid>
      <dc:creator>Dario_1</dc:creator>
      <dc:date>2003-06-12T12:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995831#M125380</link>
      <description>didn't you already post this question:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html" target="_blank"&gt;http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x97ab44f56197d711abdc0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;in any case...&lt;BR /&gt;The following script may need some minor modifications to excape any special characters in the sed statements.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/ksh&lt;BR /&gt;x=1&lt;BR /&gt;while x=1&lt;BR /&gt;do&lt;BR /&gt;cat logfile | grep 07832 Incremental database backup completed successfully.] : Log :  &amp;gt;&amp;gt; newlogfile&lt;BR /&gt;cat logfile | sed 's/07832 Incremental database backup completed successfully.] : Log : //#07832 Incremental database backup completed successfully.] : Log : /g' &amp;gt; logfile2&lt;BR /&gt;mv logfile2 logfile&lt;BR /&gt;sleep 600&lt;BR /&gt;done</description>
      <pubDate>Thu, 12 Jun 2003 12:50:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995831#M125380</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-12T12:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995832#M125381</link>
      <description>Unfortunately I was unable to use any of the script suggestions provided in yesterday's posting.&lt;BR /&gt;&lt;BR /&gt;The actual script which would run in cron would check the log file for the latest [-07832 Incremental database backup completed successfully.] message &amp;amp; compare the message date and time time to the current sytem date and time. If no new incremental successful message is in the log within a 10 minute period then it will send an opcmsg (ITO Alert) stating that the incremental backup failed. &lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your help...&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 13:19:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995832#M125381</guid>
      <dc:creator>Shaun Aldrich_1</dc:creator>
      <dc:date>2003-06-12T13:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995833#M125382</link>
      <description>Shaun,&lt;BR /&gt;&lt;BR /&gt;we gave you ideas on how to get started. If you wanted us to write the entire thing for you, then all you to do is ask.&lt;BR /&gt;&lt;BR /&gt;there is a lot of nice people on the forum&lt;BR /&gt;&lt;BR /&gt;peace&lt;BR /&gt;Donny</description>
      <pubDate>Thu, 12 Jun 2003 13:31:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995833#M125382</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-06-12T13:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995834#M125383</link>
      <description>This script may steer you in the right direction&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;x=1&lt;BR /&gt;while x=1&lt;BR /&gt;do&lt;BR /&gt;time=$(date +'%Y/%m/%d %H:%M:%S')&lt;BR /&gt;min=$(echo $time | awk -F: '{print $2}'&lt;BR /&gt;((ttime=$min-10)) &lt;BR /&gt;day=$(date +'%d')&lt;BR /&gt;year=$(date +'%Y')&lt;BR /&gt;month=$(date +'%m')&lt;BR /&gt;&lt;BR /&gt;#bs gets all successful backups from today&lt;BR /&gt;bs=$(cat file | grep $year | grep $month | grep $day | grep "Incremental database backup completed successfully")&lt;BR /&gt;&lt;BR /&gt;bstime=$(echo $bs | awk -F: '{print $2}')&lt;BR /&gt;&lt;BR /&gt;#finds 10 or less time difference&lt;BR /&gt;((timediff=$time-$bstime))&lt;BR /&gt;if [ $timediff &amp;lt;= 10 then ]&lt;BR /&gt;echo $bs &amp;gt; logfile&lt;BR /&gt;else&lt;BR /&gt;#whatever actions to send alert&lt;BR /&gt;fi&lt;BR /&gt;sleep 600&lt;BR /&gt;done</description>
      <pubDate>Thu, 12 Jun 2003 13:50:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995834#M125383</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-12T13:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995835#M125384</link>
      <description>sorry about my above syntax errors &lt;BR /&gt;&lt;BR /&gt;if [ $"timediff &amp;lt;= 10 then]&lt;BR /&gt;should be&lt;BR /&gt;if [$"timediff &amp;lt;= 10 ]&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;- i tend to think faster than I type sometimes.&lt;BR /&gt;&lt;BR /&gt;Glad to see that this was helpful though</description>
      <pubDate>Thu, 12 Jun 2003 14:10:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995835#M125384</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-06-12T14:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995836#M125385</link>
      <description>Muling this over for a day, leads me to several concerns about what your trying to do.&lt;BR /&gt;&lt;BR /&gt;Firs off, are you really looking for failures or only success?   IMHO kind of silly to look for success, when the log already shows that.   I guess you could want it for reporting, but what your getting out is not of much value to a report.&lt;BR /&gt;&lt;BR /&gt;Second, you say you want it to run every 10 or 15 minutes in cron.  How does your application schedule this?  What happens if your app runs 2 increments in the time the cron job runs 1 time?  Or what happens if the increment does not change within 2 cron jobs?&lt;BR /&gt;&lt;BR /&gt;Backups are usually dependant on external issues themselves, so writing a time dependant script when you have an I/O dependant application is not the best way to handle tracking, logging, or reporting, and in fact depending on what your doing this could be a nice shot to the foot.&lt;BR /&gt;&lt;BR /&gt;I'd recommend you make a wrapper for the backup script itself, intercept it's output and re-direct it where you need it to go.  &lt;BR /&gt;&lt;BR /&gt;Next step is to have someone code a daemon that monitors the log for changes, then acts on the changes only.&lt;BR /&gt;&lt;BR /&gt;If neither of those 2 are possible, talk to the software vendor to see if there is any way you can control the output going to the log.  Many 3rd party vendors are happy to work with you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If none of the samples given work out of the site, it's because were here as students and teachers, not sub-contracters.  Consider hiring a consultant for a day.  Really, we need to eat too! ;)&lt;BR /&gt;&lt;BR /&gt;Sincerely,&lt;BR /&gt;Shannon Petry</description>
      <pubDate>Thu, 12 Jun 2003 14:16:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995836#M125385</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2003-06-12T14:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995837#M125386</link>
      <description>Hi Shaun,&lt;BR /&gt;&lt;BR /&gt;a very simple solution: &lt;BR /&gt;# --- start of the script here&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# first, let's count the number of times the log message appears in the log file&lt;BR /&gt;# don't forget to cd to the correct directory&lt;BR /&gt;let i=`/usr/bin/grep -c "[-07832 Incremental database backup completed successfully.]" oracle0.log`&lt;BR /&gt;# then let's sleep 10 minutes&lt;BR /&gt;sleep 600 &lt;BR /&gt;# let's count the new number of occurences for the message&lt;BR /&gt;let j=`grep -c "[-07832 Incremental database backup completed successfully.]" oracle0.log`&lt;BR /&gt;&lt;BR /&gt;# if j is not strictly greater than i, you have a problem...&lt;BR /&gt;if [ $j -le $i ]&lt;BR /&gt;do&lt;BR /&gt;# put your ITO alert here&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;# end of the script&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 14:24:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995837#M125386</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-12T14:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995838#M125387</link>
      <description>Thanks everyone for your suggestions...&lt;BR /&gt;&lt;BR /&gt;I will be testing the various scripts today.&lt;BR /&gt;&lt;BR /&gt;Everyone in these forums is of great assistance. Scripting is my current weakness but an area which I am working on improving.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Shaun</description>
      <pubDate>Thu, 12 Jun 2003 14:31:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995838#M125387</guid>
      <dc:creator>Shaun Aldrich_1</dc:creator>
      <dc:date>2003-06-12T14:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995839#M125388</link>
      <description>Aaargh!&lt;BR /&gt;Sorry, Shaun, I made quite a stoopid mistake in the script I wrote...&lt;BR /&gt;&lt;BR /&gt;when I wrote:&lt;BR /&gt;---&lt;BR /&gt;if [ $j -le $i ] &lt;BR /&gt;do &lt;BR /&gt;# put your ITO alert here &lt;BR /&gt;done &lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; I, of course, meant:&lt;BR /&gt;---&lt;BR /&gt;if [ $j -le $i ] &lt;BR /&gt;then&lt;BR /&gt;# put your ITO alert here &lt;BR /&gt;fi&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;It's, of course, "if [] then [] fi"...&lt;BR /&gt; &lt;BR /&gt;Sorry about that...&lt;BR /&gt;&lt;BR /&gt;FiX &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Jun 2003 14:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995839#M125388</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-12T14:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Unix script (bourne/Korne) Needed!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995840#M125389</link>
      <description>Thanks for your assistance...</description>
      <pubDate>Thu, 12 Jun 2003 16:45:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-unix-script-bourne-korne-needed/m-p/2995840#M125389</guid>
      <dc:creator>Shaun Aldrich_1</dc:creator>
      <dc:date>2003-06-12T16:45:40Z</dc:date>
    </item>
  </channel>
</rss>

