<?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 ksh: script to handle switch beetween users in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776175#M638499</link>
    <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to collect some scripts to one script . i want start with "root" user, do some steps and switch to an "oracle" user.&lt;/P&gt;&lt;P&gt;in the oracle user i want to start another program&amp;nbsp; with "nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;" .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- how can i check , if the script is finished and ok&amp;nbsp; in the oracle user?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i also want to make the programm restart able.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what's the best way to handle this .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#1.root&lt;/P&gt;&lt;P&gt;mkdir /oracle/mnt&lt;/P&gt;&lt;P&gt;echo "1. mkdir"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;chown oracle /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#2. oracle&lt;/P&gt;&lt;P&gt;su oracle &amp;lt;&amp;lt;-EOF&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;EOF&lt;/P&gt;&lt;P&gt;echo $?&lt;/P&gt;&lt;P&gt;echo "2. oracle"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#3. oracle&lt;/P&gt;&lt;P&gt;# the special with nohup&lt;/P&gt;&lt;P&gt;su oracle &amp;lt;&amp;lt;-EOF&lt;/P&gt;&lt;P&gt;nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;&lt;/P&gt;&lt;P&gt;EOF&lt;/P&gt;&lt;P&gt;echo $?&lt;/P&gt;&lt;P&gt;echo "3. oracle"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when an error will detect, the program stops and i have to check and solve the problem. then i will start the programm again and i will check with "awk", i one step was finished ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Aug 2012 15:17:52 GMT</pubDate>
    <dc:creator>support_billa</dc:creator>
    <dc:date>2012-08-24T15:17:52Z</dc:date>
    <item>
      <title>ksh: script to handle switch beetween users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776175#M638499</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to collect some scripts to one script . i want start with "root" user, do some steps and switch to an "oracle" user.&lt;/P&gt;&lt;P&gt;in the oracle user i want to start another program&amp;nbsp; with "nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;" .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- how can i check , if the script is finished and ok&amp;nbsp; in the oracle user?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i also want to make the programm restart able.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what's the best way to handle this .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#1.root&lt;/P&gt;&lt;P&gt;mkdir /oracle/mnt&lt;/P&gt;&lt;P&gt;echo "1. mkdir"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;chown oracle /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#2. oracle&lt;/P&gt;&lt;P&gt;su oracle &amp;lt;&amp;lt;-EOF&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;EOF&lt;/P&gt;&lt;P&gt;echo $?&lt;/P&gt;&lt;P&gt;echo "2. oracle"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#3. oracle&lt;/P&gt;&lt;P&gt;# the special with nohup&lt;/P&gt;&lt;P&gt;su oracle &amp;lt;&amp;lt;-EOF&lt;/P&gt;&lt;P&gt;nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;&lt;/P&gt;&lt;P&gt;EOF&lt;/P&gt;&lt;P&gt;echo $?&lt;/P&gt;&lt;P&gt;echo "3. oracle"&amp;nbsp; &amp;gt;&amp;gt; /tmp/steps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when an error will detect, the program stops and i have to check and solve the problem. then i will start the programm again and i will check with "awk", i one step was finished ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2012 15:17:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776175#M638499</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2012-08-24T15:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776287#M638500</link>
      <description>&lt;P&gt;I never recommend large monolithic scripts that do a lot of processing that could be broken down into smaller easier to restart scripts. However, they are sometimes required when you have complex processes that require a lot of global data to be passed from one process step to another. I also recommend making use of any job control system you may have, like control-m or autosys.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With that said,&amp;nbsp; the methods I've seen use flag file(s) to record processing steps and their exit status. In the event of a failure that causes the process to halt, the core script can be restarted with either a restart flag, or designed to find and read the last unsuccessful flag and start processing again from that point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:19:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776287#M638500</guid>
      <dc:creator>Ken Grabowski</dc:creator>
      <dc:date>2012-08-24T17:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776317#M638501</link>
      <description>&lt;P&gt;&amp;gt;in the oracle user I want to start another program&amp;nbsp; with "nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;" .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the outer script isn't doing anything else, you could wait, instead of putting it in the background.&amp;nbsp; But you may not want to have it hangup on you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;if the script is finished and ok in the oracle user?&lt;/P&gt;&lt;P&gt;&amp;gt;nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;&lt;/P&gt;&lt;P&gt;&amp;gt;EOF&lt;/P&gt;&lt;P&gt;&amp;gt;echo $?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The exit status here will just check to see if the su and nohup started but not the status of "script".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As Ken said, you need to record your status in a file.&amp;nbsp; Either the contents or the existence of one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2012 17:55:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5776317#M638501</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-08-24T17:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5788915#M638502</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your answers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is a great idea to use a job control tool but for my issue it is a little overhead&lt;/P&gt;&lt;P&gt;why :&lt;/P&gt;&lt;P&gt;we have to do this steps ( or installation ) not every day or week, sometimes one time in a month .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;if the script is finished and ok in the oracle user?&lt;/P&gt;&lt;P&gt;&amp;gt;nohup ./script 2&amp;gt;&amp;amp;1 &amp;gt; script.log &amp;amp;&lt;/P&gt;&lt;P&gt;&amp;gt;EOF&lt;/P&gt;&lt;P&gt;&amp;gt;echo $?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this can we change from the background to the foreground for a better handling ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so ,&amp;nbsp; i think , i have to do the jobs step by step and not i a whole script with user switches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2012 12:33:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5788915#M638502</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2012-08-31T12:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5790495#M638503</link>
      <description>&lt;P&gt;&amp;gt;this can we change from the background to the foreground for a better handling?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes.&amp;nbsp; It's not like the script has anything else to do while waiting?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 02:21:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5790495#M638503</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-09-03T02:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5791603#M638504</link>
      <description>&lt;P&gt;&amp;gt; Yes.&amp;nbsp; It's not like the script has anything else to do while waiting?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;no nothing, these step runs about 30 minutes or longer. so we start the script in the background because want to prevent interruption of network connection and so on.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 11:12:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5791603#M638504</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2012-09-03T11:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: ksh: script to handle switch between users</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5791857#M638505</link>
      <description>&lt;P&gt;&amp;gt;because want to prevent interruption of network connection and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;nohup will do that without putting it in the background.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2012 17:27:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-to-handle-switch-beetween-users/m-p/5791857#M638505</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-09-03T17:27:58Z</dc:date>
    </item>
  </channel>
</rss>

