<?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 run shell scripts sequentially. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272397#M62514</link>
    <description>Hi All,&lt;BR /&gt;I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script.&lt;BR /&gt;&lt;BR /&gt;This same rule applies to script3 and script4.&lt;BR /&gt;&lt;BR /&gt;Can someone please help me out.This is the function that I wrote for the process check.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;process_check ()&lt;BR /&gt;{&lt;BR /&gt;p1=`ps -ef | grep o1 |grep -v grep| wc -l`&lt;BR /&gt;if [ "$p1" = 0]&lt;BR /&gt;echo "Process not running"&lt;BR /&gt;return 0&lt;BR /&gt;else&lt;BR /&gt;echo "Process  completed"&lt;BR /&gt;return 1&lt;BR /&gt;}</description>
    <pubDate>Fri, 19 Sep 2008 05:14:44 GMT</pubDate>
    <dc:creator>Rohit Khaladkar</dc:creator>
    <dc:date>2008-09-19T05:14:44Z</dc:date>
    <item>
      <title>run shell scripts sequentially.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272397#M62514</link>
      <description>Hi All,&lt;BR /&gt;I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script.&lt;BR /&gt;&lt;BR /&gt;This same rule applies to script3 and script4.&lt;BR /&gt;&lt;BR /&gt;Can someone please help me out.This is the function that I wrote for the process check.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;process_check ()&lt;BR /&gt;{&lt;BR /&gt;p1=`ps -ef | grep o1 |grep -v grep| wc -l`&lt;BR /&gt;if [ "$p1" = 0]&lt;BR /&gt;echo "Process not running"&lt;BR /&gt;return 0&lt;BR /&gt;else&lt;BR /&gt;echo "Process  completed"&lt;BR /&gt;return 1&lt;BR /&gt;}</description>
      <pubDate>Fri, 19 Sep 2008 05:14:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272397#M62514</guid>
      <dc:creator>Rohit Khaladkar</dc:creator>
      <dc:date>2008-09-19T05:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: run shell scripts sequentially.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272398#M62515</link>
      <description>&lt;!--!*#--&gt;As this is posted in the Linux section&lt;BR /&gt;why not use pgrep like&lt;BR /&gt;&lt;BR /&gt;$  proc_is_up() { pgrep ${1:-''} &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; }&lt;BR /&gt;&lt;BR /&gt;and simply base your control flow on it like&lt;BR /&gt;&lt;BR /&gt;$ if proc_is_up bla;then echo runs;else echo absent;fi&lt;BR /&gt;absent&lt;BR /&gt; &lt;BR /&gt;$ if proc_is_up httpd;then echo runs;else echo absent;fi&lt;BR /&gt;runs&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Sep 2008 10:33:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272398#M62515</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2008-09-19T10:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: run shell scripts sequentially.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272399#M62516</link>
      <description>&lt;!--!*#--&gt;Maybe pidof could work?&lt;BR /&gt;something like this:&lt;BR /&gt;&lt;BR /&gt;if pidof name_of_proc; then&lt;BR /&gt;   return 0&lt;BR /&gt;else&lt;BR /&gt;   return 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;If there are multiple process with the same name this probably won't work. It'll return the all the pids of all the process by that name. But if this is a unique name I would say that it's a good slim variant :)</description>
      <pubDate>Thu, 02 Oct 2008 12:46:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272399#M62516</guid>
      <dc:creator>Fredrik.eriksson</dc:creator>
      <dc:date>2008-10-02T12:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: run shell scripts sequentially.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272400#M62517</link>
      <description>&amp;gt;&amp;gt;&amp;gt; I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script.&lt;BR /&gt;&lt;BR /&gt;I would then add the checking on the first script. If the process is running, exit with 0, if not, exit with 1.&lt;BR /&gt;&lt;BR /&gt;Then in your master script set:&lt;BR /&gt;&lt;BR /&gt;script1.sh &amp;amp;&amp;amp; script2.sh&lt;BR /&gt;&lt;BR /&gt;And so on.</description>
      <pubDate>Thu, 02 Oct 2008 13:20:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-shell-scripts-sequentially/m-p/4272400#M62517</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2008-10-02T13:20:32Z</dc:date>
    </item>
  </channel>
</rss>

