<?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: Need help with su cmd in a shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900331#M701664</link>
    <description>You ned to do this:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/su - oracle -c "oracle command line"&lt;BR /&gt;&lt;BR /&gt;This gets you the environment and issues the command within the double quotes.&lt;BR /&gt;&lt;BR /&gt;Thats how we do what you wish to do.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Thu, 05 May 2005 22:55:37 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2005-05-05T22:55:37Z</dc:date>
    <item>
      <title>Need help with su cmd in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900330#M701663</link>
      <description>Aloha Sharp HP Folks,&lt;BR /&gt;&lt;BR /&gt;I have written a very simple &amp;amp; basic shell script which I hope will allow me to cron my Oracle 9i startup (and shutdown) times. When I run these commands as root from within the root's shell manually, they work just fine. But when I run the very same commands in the root context from within my simple shell script below, it seems to get "stuck" on the su - oracle command and everything breaks down from there. My shell script will just wait in my Oracle home dir, and when I exit out from su, the shell script continues processing with the . .profile line but the dbstart is useless without the Oracle home environment parameters. Is there something I am missing with trying to su from within a shell script? My OS is HP-UX 11.0. Thanks in advance for anyone who can help steer me in the right direction with this.&lt;BR /&gt;&lt;BR /&gt;Very Respectfully,&lt;BR /&gt;Chris Elmore&lt;BR /&gt;&lt;BR /&gt;x----------x cut here x----------x&lt;BR /&gt;&lt;BR /&gt;clear&lt;BR /&gt;cd /&lt;BR /&gt;su - oracle&lt;BR /&gt;. .profile&lt;BR /&gt;dbstart&lt;BR /&gt;mailx -s"Oracle 9i has started!" user@email.com &amp;lt; /export/chris/oracle_startup.txt&lt;BR /&gt;</description>
      <pubDate>Thu, 05 May 2005 22:38:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900330#M701663</guid>
      <dc:creator>Chris Elmore</dc:creator>
      <dc:date>2005-05-05T22:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with su cmd in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900331#M701664</link>
      <description>You ned to do this:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/su - oracle -c "oracle command line"&lt;BR /&gt;&lt;BR /&gt;This gets you the environment and issues the command within the double quotes.&lt;BR /&gt;&lt;BR /&gt;Thats how we do what you wish to do.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 05 May 2005 22:55:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900331#M701664</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-05-05T22:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with su cmd in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900332#M701665</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;In general, the script that you want to su another user and execute a command is:&lt;BR /&gt;&lt;BR /&gt;su - &lt;USER&gt; -c&lt;BR /&gt;&lt;BR /&gt;For example: If you want to execute a script or command like: /home/oracle/script/check_pef.sh&lt;BR /&gt;Then the command:&lt;BR /&gt;su - oracle -c "sh /home/oracle/script/check_pef.sh"&lt;BR /&gt;&lt;BR /&gt;Do you realy want to make  script file? Give me your email, I have script to shutdown and start Oracle database and it is running now in my system....but for Oracle 8i.&lt;BR /&gt;&lt;BR /&gt;Regard,&lt;BR /&gt;HoangChiCong&lt;/USER&gt;</description>
      <pubDate>Thu, 05 May 2005 23:25:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900332#M701665</guid>
      <dc:creator>Hoang Chi Cong_1</dc:creator>
      <dc:date>2005-05-05T23:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with su cmd in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900333#M701666</link>
      <description>Aloha Folks,&lt;BR /&gt;&lt;BR /&gt;You are the best. That switch was exactly what I needed. I tested the script and it works now. Oracle 9i has a dbstart and dbshut script that automates the startup and shutdown of Oracle and Listener respectively, and the only catch was to get it to run under cron within the Oracle login context. You gave me the tool I needed to make that happen. Again, I really appreciate you sharing your expertise. Take care.&lt;BR /&gt;&lt;BR /&gt;Very Respectfully,&lt;BR /&gt;Chris Elmore</description>
      <pubDate>Fri, 06 May 2005 13:44:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-su-cmd-in-a-shell-script/m-p/4900333#M701666</guid>
      <dc:creator>Chris Elmore</dc:creator>
      <dc:date>2005-05-06T13:44:09Z</dc:date>
    </item>
  </channel>
</rss>

