<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006480#M910951</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;if [ `ps -ef|grep -v grep|grep -c java` -lt 2 ]&lt;BR /&gt;then&lt;BR /&gt;/usr/bin/mailx -s "java process down" abc@123.com&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Not that it's so different from the other solutions you've had, but people always forget to use the "grep -c" command...&lt;BR /&gt;&lt;BR /&gt;FiX</description>
    <pubDate>Wed, 25 Jun 2003 06:06:25 GMT</pubDate>
    <dc:creator>F. X. de Montgolfier</dc:creator>
    <dc:date>2003-06-25T06:06:25Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006473#M910944</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;There are 2 java process running on my server.&lt;BR /&gt;I want to monitor them:&lt;BR /&gt;&lt;BR /&gt;# ps -ef|grep java&lt;BR /&gt;    root 20222     1  0 11:38:40 pts/0    0:26 /usr/java1.3.1/bin/../bin/sparc/n&lt;BR /&gt;ative_threads/java -classpath /usr/java1.3.1/l&lt;BR /&gt;    root 20293 20187  0 12:55:05 pts/0    0:00 grep java&lt;BR /&gt;    root 20173     1  0 11:37:30 pts/0    1:26 /usr/java1.3.1/bin/../bin/sparc/n&lt;BR /&gt;ative_threads/java -DproxySet=true -DproxyHost&lt;BR /&gt;&lt;BR /&gt;If any of the 2 java was down, then email to&lt;BR /&gt;abc@123.com&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 25 Jun 2003 03:56:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006473#M910944</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-06-25T03:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006474#M910945</link>
      <description>Basic structure&lt;BR /&gt;&lt;BR /&gt;ps -ef | grep java &amp;gt; /tmp/javamon&lt;BR /&gt;&lt;BR /&gt;# You may need something more unique than java, but you'll have to tweak it.&lt;BR /&gt;&lt;BR /&gt;javaproc=`wc -l` /tmp/javamon&lt;BR /&gt;&lt;BR /&gt;if [ javaproc le 3 ] then&lt;BR /&gt;   mailx -s "java process problem" abc@123.com&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;there are a lot of better script writers out there. I am certain someone will top me.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 25 Jun 2003 04:08:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006474#M910945</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-06-25T04:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006475#M910946</link>
      <description>Hi,&lt;BR /&gt;That's easy if you have your Sendmail configured OK!&lt;BR /&gt;&lt;BR /&gt;if ps -ef|grep -v $$|grep "java"&lt;BR /&gt;then&lt;BR /&gt;echo ""&lt;BR /&gt;else&lt;BR /&gt;mailx -s "At least one java service is down" abc@123.com fi&lt;BR /&gt;&lt;BR /&gt;Have a good day!&lt;BR /&gt;-ux</description>
      <pubDate>Wed, 25 Jun 2003 04:12:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006475#M910946</guid>
      <dc:creator>Fragon</dc:creator>
      <dc:date>2003-06-25T04:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006476#M910947</link>
      <description>thanks!&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2003 04:12:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006476#M910947</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-06-25T04:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006477#M910948</link>
      <description>#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;PROC_CHK=$(ps -ef | grep [j]ava | wc -l)&lt;BR /&gt;&lt;BR /&gt;if [ $PROC_CHK -ne 2 ] &lt;BR /&gt;then&lt;BR /&gt; echo "Jave Processes Running: $PROC_CHK" | mailx -s "Jave Process Problem" abc@123.com&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Con</description>
      <pubDate>Wed, 25 Jun 2003 04:12:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006477#M910948</guid>
      <dc:creator>Con O'Kelly</dc:creator>
      <dc:date>2003-06-25T04:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006478#M910949</link>
      <description>thanks!&lt;BR /&gt;I will try it later,pls reply so I can give you&lt;BR /&gt;10 points if it works. :)</description>
      <pubDate>Wed, 25 Jun 2003 04:13:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006478#M910949</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-06-25T04:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006479#M910950</link>
      <description>Sorry,a little bug, it's a new one:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;&lt;BR /&gt;pjavan=ps -ef|grep -v $$|grep -i java |wc -l &lt;BR /&gt;&lt;BR /&gt;if [ $pjavan -ln 2 ] &lt;BR /&gt;then &lt;BR /&gt;echo "Some msg you want!"|mailx -s "At least one Java process down!" abc@123.com &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;-ux</description>
      <pubDate>Wed, 25 Jun 2003 04:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006479#M910950</guid>
      <dc:creator>Fragon</dc:creator>
      <dc:date>2003-06-25T04:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006480#M910951</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;if [ `ps -ef|grep -v grep|grep -c java` -lt 2 ]&lt;BR /&gt;then&lt;BR /&gt;/usr/bin/mailx -s "java process down" abc@123.com&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Not that it's so different from the other solutions you've had, but people always forget to use the "grep -c" command...&lt;BR /&gt;&lt;BR /&gt;FiX</description>
      <pubDate>Wed, 25 Jun 2003 06:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006480#M910951</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-25T06:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006481#M910952</link>
      <description>Hi FiX,&lt;BR /&gt;&lt;BR /&gt;when I run your script, it seems hang,&lt;BR /&gt;I can not get the mail. any idea?</description>
      <pubDate>Wed, 25 Jun 2003 06:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006481#M910952</guid>
      <dc:creator>Michael_33</dc:creator>
      <dc:date>2003-06-25T06:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006482#M910953</link>
      <description>You should include a filename in the last part of the mailx command as the body of the mail:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/mailx -s "java process down" abc@mail.com &amp;lt; filename, if you want a plain body, simply replace the filename with /dev/null.&lt;BR /&gt;&lt;BR /&gt;Kenneth</description>
      <pubDate>Wed, 25 Jun 2003 06:57:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006482#M910953</guid>
      <dc:creator>Kenneth_19</dc:creator>
      <dc:date>2003-06-25T06:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006483#M910954</link>
      <description>Michael,&lt;BR /&gt;&lt;BR /&gt;yes, I have an idea: I'm stoopid ;-P&lt;BR /&gt;You need to have a body for the mailx command.&lt;BR /&gt;&lt;BR /&gt;the correct script is:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh &lt;BR /&gt;if [ `ps -ef|grep -v grep|grep -c java` -lt 2 ] &lt;BR /&gt;then &lt;BR /&gt;echo "this is what I forgot in the last message"|/usr/bin/mailx -s "java process down" abc@123.com &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;Sorry, my bad...&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2003 07:01:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006483#M910954</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-06-25T07:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006484#M910955</link>
      <description>To check every 15:th minute&lt;BR /&gt;&lt;BR /&gt;# crontab -e&lt;BR /&gt;0,15,30,45 * * * * expr $(ps -ef|grep java|grep -v grep|wc -l) != 2 &amp;gt;/dev/null &amp;amp;&amp;amp; mail -s "Java proc. down" abc@123.com</description>
      <pubDate>Thu, 26 Jun 2003 05:52:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3006484#M910955</guid>
      <dc:creator>Tommy Palo</dc:creator>
      <dc:date>2003-06-26T05:52:25Z</dc:date>
    </item>
  </channel>
</rss>

