<?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: Help on Shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662919#M930652</link>
    <description>Consider installing logcheck.  It scans the log periodically reporting all messages not excluded.  You can flag certain messages as violations and they will be reported at the head of the list.</description>
    <pubDate>Wed, 13 Feb 2002 15:04:25 GMT</pubDate>
    <dc:creator>Bill Thorsteinson</dc:creator>
    <dc:date>2002-02-13T15:04:25Z</dc:date>
    <item>
      <title>Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662914#M930647</link>
      <description>Hello all,&lt;BR /&gt;Can you please help me in writing a shell script for continously monitoring the syslog file for certain errors and if that error occurs then execute a particular command.&lt;BR /&gt;Thanks &lt;BR /&gt;Sudhakaran.S</description>
      <pubDate>Tue, 12 Feb 2002 07:54:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662914#M930647</guid>
      <dc:creator>SUDHAKARAN.</dc:creator>
      <dc:date>2002-02-12T07:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662915#M930648</link>
      <description>The only way I know of to do this reliably is to schedule something via cron.&lt;BR /&gt;&lt;BR /&gt;You can use tail -f &lt;LOGFILE&gt; but when the log file is rolled or a new one is created, the tail stops working.&lt;BR /&gt;&lt;BR /&gt;I prefer a cron job that executes at n times per day and then just greps for the errors.&lt;BR /&gt;&lt;BR /&gt;For example, my backup write this into the syslog:&lt;BR /&gt;&lt;BR /&gt;Feb 12 02:01:48 melhpor1 syslog: INFO: LVM backups for host &lt;MELHPOR1&gt; finished.&lt;BR /&gt;..&lt;/MELHPOR1&gt;&lt;/LOGFILE&gt;</description>
      <pubDate>Tue, 12 Feb 2002 08:03:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662915#M930648</guid>
      <dc:creator>Scott Van Kalken</dc:creator>
      <dc:date>2002-02-12T08:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662916#M930649</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You need to write a script that looks&lt;BR /&gt;at the /var/adm/syslog/syslog.log&lt;BR /&gt;file. In doing so you will need to &lt;BR /&gt;describe the errors or warnings that &lt;BR /&gt;you may be looking for. So at given &lt;BR /&gt;times of the day using cron, use&lt;BR /&gt;tail -f xxxx lines and grep for the&lt;BR /&gt;errors you might be looking for.&lt;BR /&gt;&lt;BR /&gt;-Michael</description>
      <pubDate>Tue, 12 Feb 2002 08:14:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662916#M930649</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2002-02-12T08:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662917#M930650</link>
      <description>oops - lo9st half the post - too busy watching a purge of omniback....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;anyway....&lt;BR /&gt;&lt;BR /&gt;an exmaple would be:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;SCRIPT=${0##*/}&lt;BR /&gt;PATH=/bin:/sbin:/usr/bin:/whatever&lt;BR /&gt;&lt;BR /&gt;if grep -q &lt;THE string="" you="" are="" looking="" for=""&gt; ; then mailx -s "oh my god there's an error" root@machine.com&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if you're feeling artistic, put the error lines into a file and do something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;#########################################################&lt;BR /&gt;#&lt;BR /&gt;# Short script to check for oracle databases&lt;BR /&gt;# Nothing fancy&lt;BR /&gt;# Has $basename.conf file to add database name to&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;# v1.00 22/5/01&lt;BR /&gt;#&lt;BR /&gt;# Scott van Kalken&lt;BR /&gt;#########################################################&lt;BR /&gt;&lt;BR /&gt;######################################################&lt;BR /&gt;# Couple of variables - only the essentials man      #&lt;BR /&gt;######################################################&lt;BR /&gt;&lt;BR /&gt;SCRIPT=${0##*/}&lt;BR /&gt;CONF=/opt/admin/morning_checks/$SCRIPT.conf&lt;BR /&gt;PATH=/usr/bin:/opt/admin/morning_checks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#####################################################&lt;BR /&gt;# Functions&lt;BR /&gt;#&lt;BR /&gt;# Function go checks everything that needs to be&lt;BR /&gt;#&lt;BR /&gt;#####################################################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;go(){&lt;BR /&gt;while read database&lt;BR /&gt;do&lt;BR /&gt;dbup=`ps -ef | grep -v grep | grep -c ora_pmon_$database`&lt;BR /&gt;if [ $dbup -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;  echo $database IS NOT UP&lt;BR /&gt;else&lt;BR /&gt;  echo $database IS UP&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;###########################################################&lt;BR /&gt;#&lt;BR /&gt;# Main Script - if no conf file then blat out&lt;BR /&gt;#&lt;BR /&gt;###########################################################&lt;BR /&gt;&lt;BR /&gt;if [ ! -f $CONF ] ; then echo "No Conf File" ; exit 1; fi&lt;BR /&gt;go &amp;lt; $CONF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This is a script to check whether or not oracle databases are up in the morning after cold backup. &lt;BR /&gt;&lt;BR /&gt;Although we're moving to hot backup, it's still nice to see that they're at least up.&lt;BR /&gt;&lt;BR /&gt;I'm thinking of something neat to test test for actual functionality in version 59.1 :)&lt;BR /&gt;&lt;BR /&gt;Anyhow, hope this helps get you started.&lt;BR /&gt;&lt;BR /&gt;Scott.&lt;BR /&gt;&lt;/THE&gt;</description>
      <pubDate>Tue, 12 Feb 2002 08:28:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662917#M930650</guid>
      <dc:creator>Scott Van Kalken</dc:creator>
      <dc:date>2002-02-12T08:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662918#M930651</link>
      <description>Hi Sudahkaran,&lt;BR /&gt;&lt;BR /&gt;the following script could do the job for you:&lt;BR /&gt;&lt;BR /&gt;tail -n 5 /var/adm/syslog/syslog.log &amp;gt; /path_to_logfile&lt;BR /&gt;# output of tail is written into logfile&lt;BR /&gt;&lt;BR /&gt;grep 'error_message' /path_to_logfile &lt;BR /&gt;&lt;BR /&gt;#grep looks for error_message&lt;BR /&gt;&lt;BR /&gt;if test $? -eq 0&lt;BR /&gt;then&lt;BR /&gt;      command_to_be_done_in_this_case&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;# if found, then command is executed&lt;BR /&gt;&lt;BR /&gt;You simply have to put this script as cronjob, done as often as you need!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Feb 2002 12:28:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662918#M930651</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-02-12T12:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662919#M930652</link>
      <description>Consider installing logcheck.  It scans the log periodically reporting all messages not excluded.  You can flag certain messages as violations and they will be reported at the head of the list.</description>
      <pubDate>Wed, 13 Feb 2002 15:04:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-shell-script/m-p/2662919#M930652</guid>
      <dc:creator>Bill Thorsteinson</dc:creator>
      <dc:date>2002-02-13T15:04:25Z</dc:date>
    </item>
  </channel>
</rss>

