<?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: Shell Scripts for monitoring and starting the process in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970470#M95330</link>
    <description>Yes, although the typical approach there is to create an inittab entry and make it a 'respawn' task. Each time the task exits, init automatically restarts it.&lt;BR /&gt;&lt;BR /&gt;There are several ways to do what you want but continuously running ps could impose an abnormal load on the system.&lt;BR /&gt;&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;typeset PROCESS-"tulip-web-admin"&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;typeset -i DELAY=10&lt;BR /&gt;&lt;BR /&gt;while [[ 1 -eq 1 ]]&lt;BR /&gt;  do&lt;BR /&gt;UNIX95=1 ps -C "${PROCESS}" -o pid='' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;then&lt;BR /&gt;/opt/somedirectory/tulip.sh # you may ned a &amp;amp; to start in background ?&lt;BR /&gt;STAT=${?}&lt;BR /&gt;echo "Restarted" | mail mickey@mouse.com&lt;BR /&gt;fi&lt;BR /&gt;  sleep ${DELAY}&lt;BR /&gt;  done&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This would check every ${DELAY} seconds.&lt;BR /&gt;&lt;BR /&gt;Here's another approach leveraging wait (and is a bit cleaner):&lt;BR /&gt;&lt;BR /&gt;typeset -i CHILD=0&lt;BR /&gt;while [[ 1 -eq 1 ]]&lt;BR /&gt;  do&lt;BR /&gt;     /opt/somedirectory/tulip.sh &amp;amp;&lt;BR /&gt;     CHILD=${!}&lt;BR /&gt;     wait ${CHILD}&lt;BR /&gt;     echo "Restarted" | mail mickey@mouse.com&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;Either of these scripts should be put set up as an rc'ed command so that this is the sole means of starting the script. HOWEVER, you still seem to be fixing symptoms of a bad application.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 27 Mar 2007 16:01:04 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2007-03-27T16:01:04Z</dc:date>
    <item>
      <title>Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970467#M95327</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I want to monitor a process and whenever it stops we should receive email notification and execute the command&lt;BR /&gt;for starting the process.&lt;BR /&gt;&lt;BR /&gt;For example: i want to monitor the process name "tulip-web-admin". Once it is found that&lt;BR /&gt;the process is not running then it should send email notification and start /opt/somedirectory/tulip.sh script.&lt;BR /&gt;&lt;BR /&gt;And we should receive the email notification that process has been re-started.&lt;BR /&gt;&lt;BR /&gt;Can any one suggest korn shell script for this ?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv</description>
      <pubDate>Tue, 27 Mar 2007 15:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970467#M95327</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2007-03-27T15:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970468#M95328</link>
      <description>Okay, here goes:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh (or #!/usr/bin/ksh if you insist)&lt;BR /&gt;&lt;BR /&gt;typeset PROCESS-"tulip-web-admin"&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;&lt;BR /&gt;UNIX95=1 ps -C "${PROCESS}" -o pid='' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;  then&lt;BR /&gt;    /opt/somedirectory/tulip.sh # you may ned a &amp;amp; to start in background ?&lt;BR /&gt;    STAT=${?}&lt;BR /&gt;    echo "Restarted" | mail mickey@mouse.com&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;You then cron this script to run every 5 minutes or so.&lt;BR /&gt;&lt;BR /&gt;Generally this is a Mickey Mouse solution because it appears that you are trying to fix the symptoms rather than fixing the problem itself --- ie, why is the process dying?&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Mar 2007 15:37:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970468#M95328</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-27T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970469#M95329</link>
      <description>Clay, Is it possible to check continuously without putting this script in the crobtab ?</description>
      <pubDate>Tue, 27 Mar 2007 15:41:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970469#M95329</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2007-03-27T15:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970470#M95330</link>
      <description>Yes, although the typical approach there is to create an inittab entry and make it a 'respawn' task. Each time the task exits, init automatically restarts it.&lt;BR /&gt;&lt;BR /&gt;There are several ways to do what you want but continuously running ps could impose an abnormal load on the system.&lt;BR /&gt;&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;typeset PROCESS-"tulip-web-admin"&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;typeset -i DELAY=10&lt;BR /&gt;&lt;BR /&gt;while [[ 1 -eq 1 ]]&lt;BR /&gt;  do&lt;BR /&gt;UNIX95=1 ps -C "${PROCESS}" -o pid='' &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -ne 0 ]]&lt;BR /&gt;then&lt;BR /&gt;/opt/somedirectory/tulip.sh # you may ned a &amp;amp; to start in background ?&lt;BR /&gt;STAT=${?}&lt;BR /&gt;echo "Restarted" | mail mickey@mouse.com&lt;BR /&gt;fi&lt;BR /&gt;  sleep ${DELAY}&lt;BR /&gt;  done&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;---------------------------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This would check every ${DELAY} seconds.&lt;BR /&gt;&lt;BR /&gt;Here's another approach leveraging wait (and is a bit cleaner):&lt;BR /&gt;&lt;BR /&gt;typeset -i CHILD=0&lt;BR /&gt;while [[ 1 -eq 1 ]]&lt;BR /&gt;  do&lt;BR /&gt;     /opt/somedirectory/tulip.sh &amp;amp;&lt;BR /&gt;     CHILD=${!}&lt;BR /&gt;     wait ${CHILD}&lt;BR /&gt;     echo "Restarted" | mail mickey@mouse.com&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;Either of these scripts should be put set up as an rc'ed command so that this is the sole means of starting the script. HOWEVER, you still seem to be fixing symptoms of a bad application.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Mar 2007 16:01:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970470#M95330</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-27T16:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970471#M95331</link>
      <description>By the way, the production version of these scripts should have a trap that would 1) kill the tulip-web-admin process and 2) terminate the monitor script. This part is left as an exercise.</description>
      <pubDate>Tue, 27 Mar 2007 16:02:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970471#M95331</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-27T16:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970472#M95332</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I have been developing a new tool - sentinel - which does what you want (and more) and I am looking for beta testers for it.&lt;BR /&gt;&lt;BR /&gt;Could you send me your contact so that I could give you instructions on how to use it? It comes bundled with WDB 5.6 and later available on the web, but is not an officially supported tool until we can understand its use needs.&lt;BR /&gt;&lt;BR /&gt;Thanx!&lt;BR /&gt;Veeru@hp.com</description>
      <pubDate>Wed, 28 Mar 2007 11:47:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970472#M95332</guid>
      <dc:creator>Veeru_1</dc:creator>
      <dc:date>2007-03-28T11:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970473#M95333</link>
      <description>Hi Veeru,&lt;BR /&gt;&lt;BR /&gt;Please email me on:&lt;BR /&gt;&lt;BR /&gt;sksonkar@gmail.com&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv</description>
      <pubDate>Wed, 28 Mar 2007 11:50:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970473#M95333</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2007-03-28T11:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970474#M95334</link>
      <description>Hi Shiv:&lt;BR /&gt;&lt;BR /&gt;Shame on you!  You asked this very question last year.  If you examine the very rich number of question and responses associated with YOUR profile:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://forums1.itrc.hp.com/service/forums/publicProfile.do?userId=CA1283218&amp;amp;forumId=1" target="_blank"&gt;https://forums1.itrc.hp.com/service/forums/publicProfile.do?userId=CA1283218&amp;amp;forumId=1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;...then you would find:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=996430" target="_blank"&gt;https://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=996430&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;...from January 2006 which answered this question!!!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 28 Mar 2007 12:54:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970474#M95334</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-28T12:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970475#M95335</link>
      <description>&amp;gt;JRF: You asked this very question last year&lt;BR /&gt;&lt;BR /&gt;Except I noticed it and told Veeru about it.  :-)</description>
      <pubDate>Wed, 28 Mar 2007 14:33:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970475#M95335</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-28T14:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970476#M95336</link>
      <description>James, &lt;BR /&gt;&lt;BR /&gt;I changed my job and was not able to trace the earlier responses. Unfortunately, after posting the question i came to know how to look for the previous responses.&lt;BR /&gt;&lt;BR /&gt;I apologize with the forum members.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Shiv</description>
      <pubDate>Wed, 28 Mar 2007 17:39:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970476#M95336</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2007-03-28T17:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970477#M95337</link>
      <description>Shalom Shiv,&lt;BR /&gt;&lt;BR /&gt;One of the things I use my forums profile is to find good threads from the past.&lt;BR /&gt;&lt;BR /&gt;When I find a thread that is really good, I add it to my ITRC favorites. Two reasons:&lt;BR /&gt;&lt;BR /&gt;1) So I can use the thread to handle a situation I don't often have to perform. Memory aid really.&lt;BR /&gt;&lt;BR /&gt;2) So I can cut and paste code or a thread link for answering ITRC questions.&lt;BR /&gt;&lt;BR /&gt;An example of number 2 is the mirror with mirror/ux post I often use. It comes from my forums favorite.&lt;BR /&gt;&lt;BR /&gt;Don't worrry about the mistake, I make more than my share posting replies. &lt;BR /&gt;&lt;BR /&gt;No need to point this post, just don't want you to feel so bad.&lt;BR /&gt;&lt;BR /&gt;All is forgiven. By me, I don't speak for others.&lt;BR /&gt;&lt;BR /&gt;The question did seem very familiar to me.&lt;BR /&gt;&lt;BR /&gt;:-) &lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 28 Mar 2007 18:14:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970477#M95337</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-03-28T18:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripts for monitoring and starting the process</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970478#M95338</link>
      <description>Hi (again) Shiv:&lt;BR /&gt;&lt;BR /&gt;Remembering every detail, or even how to do something, is less important than learning *how* to find an answer.&lt;BR /&gt;&lt;BR /&gt;Sometimes the "how" is searching manpages and *trying* to write something that fits your needs and solves a problem.  Perfection is an endless journey.&lt;BR /&gt;&lt;BR /&gt;The Chinese say, "Give a man a fish and you feed him for a day.  Teach a man to fish and you feed him for a lifetime."&lt;BR /&gt;&lt;BR /&gt;Take my gentle admonishment in my first response in the manner I intended it: an encouragement to fish. &lt;BR /&gt;&lt;BR /&gt;You need not award points for this.&lt;BR /&gt;&lt;BR /&gt;Regards to you, Shiv!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 28 Mar 2007 19:06:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-scripts-for-monitoring-and-starting-the-process/m-p/3970478#M95338</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-28T19:06:12Z</dc:date>
    </item>
  </channel>
</rss>

